Question: why the namespace? #375
-
|
I have been playing around with uv as a build tool for cloud artifacts for a while and I love this tool so far! I was wondering what the motivation for every brick to be in the same namespace? So that every import is from the same namespace - it just feels unecessary and not as pythonic as having the namesapces be the names of the bricks themselves Also - in the example for python I see the dependecies are declared in the root pyproject. How come uv workspaces aren't encouraged to split up dependencies for builds? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
|
Hi @fraser-langton, I'm happy that you have found Polylith! Having the same top namespace is a lot about keeping things simple and clear where the code comes from, it's also about sharing code: making things obvious instead of the risk of hiding code in domain-specific namespaces. Is it not Pythonic? The root pyproject will have all the dependencies, and all the bricks. This is the environment you work in and where the |
Beta Was this translation helpful? Give feedback.
I'm curious about what you mean with repetitive, maybe I misunderstand something? If you view it from a single-repo perspective, you'll have the code in an
appfolder or a similar name. You access the entire code base by typingfrom app import something, or using relative imports. That's exactly how the Polylith structure works. This is just plain Python, and Polylith doesn't do anything different there. You can also view thebasesandcomponentsas equivalents to asrcdirectory.The bricks aren't the same thing as libraries, in Polylith you are encouraged to organize the code in much smaller units than a library (that's the LEGO brick metaphor). That means (even if you can) it is not re…