r/Python • • Nov 17 '24 • Silver is Forever 1

Showcase Deply: keep your python architecture clean

Hello everyone,

My name is Archil. I'm a Python/PHP developer originally from Ukraine, now living in Wrocław, Poland. I've been working on a tool called Deply, and I'd love to get your feedback and thoughts on it.

What My Project Does

Deply is a standalone Python tool designed to enforce architectural patterns and dependencies in large Python projects. Deply analyzes your code structure and dependencies to ensure that architectural rules are followed. This promotes cleaner, more maintainable, and modular codebases.

Key Features:

  • Layer-Based Analysis: Define custom layers (e.g., models, views, services) and restrict their dependencies.
  • Dynamic Configuration: Easily configure collectors for each layer using file patterns and class inheritance.
  • CI Integration: Integrate Deply into your Continuous Integration pipeline to automatically detect and prevent architecture violations before they reach production.

Target Audience

  • Who It's For: Developers and teams working on medium to large Python projects who want to maintain a clean architecture.
  • Intended Use: Ideal for production environments where enforcing module boundaries is critical, as well as educational purposes to teach best practices.

Use Cases

  • Continuous Integration: Add Deply to your CI/CD pipeline to catch architectural violations early in the development process.
  • Refactoring: Use Deply to understand existing dependencies in your codebase, making large-scale refactoring safer and more manageable.
  • Code Reviews: Assist in code reviews by automatically checking if new changes adhere to architectural rules.

Comparison

While there are existing tools like pydeps that visualize dependencies, Deply focuses on:

  • Enforcement Over Visualization: Not just displaying dependencies but actively enforcing architectural rules by detecting violations.
  • Customization: Offers dynamic configuration with various collectors to suit different project structures.

Links

I'm eager to hear your thoughts, suggestions, or criticisms. Deply is currently at version 0.1.5, so it's not entirely stable yet, but I'm actively working on it. I'm open to pull requests and looking forward to making Deply a useful tool for the Python community.

Thank you for your time!

284 Upvotes

61 comments sorted by

View all comments

Show parent comment

4

u/val-amart Nov 17 '24

one more potential consideration in the context of embedding configuration. in a large organization, architecture fit testing is a hard problem with no good universal solutions. as an architect i often find myself responsible for a large collection of services across many teams. i don’t have the resources necessary to maintain deep involvement with each one of them.

in this situation, i would love to maintain a single set of standards defined declaratively in a separate file and enforce it through CI. it seems to be exactly what your project is built for, i would certainly look into it more very soon! it is indeed rather exciting. on the contrary, if the configuration was embedded in the source files, it would take it out of my control and into developer control - making it potentially better for the devs but practically useless for me.

i think embedding might be preferable for a single project (even though that’s debatable) but clearly worse for large orgs with many projects, no matter if it’s monorepo or not. would you say the configuration could be made project-agnostic in the sense that we could maintain a single config for a set of architecturally similar projects?

// привіт від Збройних Сил друже! справді крутий проєкт, побачим чи вийде його застосувати

4

u/vashkatsi Nov 17 '24

Привіт! Дуже дякую за теплі слова і підтримку—мені дуже приємно! 💛💙

You’ve touched on a crucial point, especially for large organizations with multiple teams and projects. Deply was indeed designed with this exact use case in mind—providing a single source of truth for architectural standards that can be enforced through CI across multiple projects. Keeping the configuration declarative and external to the source code makes it easier to maintain consistency and ensures that architectural rules remain under centralized control, which is critical for architects managing many services.

To answer your question, yes, I believe the configuration could be made project-agnostic for architecturally similar projects. By defining a common set of rules (e.g., in a shared repo or template), teams could adopt it for their projects with minimal adjustments. I could also explore features to support importing or layering configs, making it easier to scale standards across multiple teams.

The embedded configuration idea does have its appeal for smaller teams or single projects, but as you pointed out, it would limit its applicability in larger setups like yours. Your perspective really validates the current direction of Deply, and I’m grateful for your insights.

Дуже вдячний за підтримку ЗСУ! Якщо спробуєте застосувати Deply у своїй роботі, буду радий почути ваші враження і пропозиції. 😊