I wrote a blog post about Pantsbuild and combining...
# random
b
I wrote a blog post about Pantsbuild and combining it with Polylith - a Monorepo Architecture. I hope it is okay to post the link here: https://davidvujic.blogspot.com/2024/05/pants-and-polylith.html
👍 4
👀 2
h
Thanks for posting. In fact this would be fine in #general too, since it's directly Pants-related.
🙏 1
f
@flat-zoo-31952 you may find this interesting
đŸ€© 1
👀 1
b
I’m here If you have any questions or feedback, or if you rather post a message in the discussions section of the Python Polylith repo.
f
I was looking at using Polylith for our repo at Aiven, but it seems bound pretty tightly to the pip ecosystem (same problem with a lot of normal Python tools for us tbh). Life's hard when you use distro-supplied python libs. đŸ˜© I thought it might not be too hard to modify to suit our needs though. But one other big question did come up: why can't components depend on each other? It seems weird that projects are designed such that they have to identify the full transitive set of projects they depend on, rather than being able to pull them in via component dependencies. This seems to apply to the inspiration clojure project as well, where a component can depend on another component but that doesn't seem expressed in any way in the component metadata. As someone that's worked a lot on build systems-y things, I find this very odd. Is there some automation or inference or other thing going on here?
@busy-piano-29318 Genuinely curious about this ^. Because otherwise it looks like a really neat tool.
b
I believe components and how they depend on each other works the same in the Clojure and Python implementation. The main reason is that you won’t need any build tool other than what’s available already within the ecosystem - specifying the source path(s). I added a convenience feature called “poly sync” that will follow the imports of the source code and update the pyproject.tomls. This is not in the Clojure version (they are more strict about “no magic” than I am). The Clojure implementation has the third-party dependencies optionally specified in a component-specific “deps” config. I chose not to implement it in the Python tooling, especially after recently when I learned that is already there in Pants 😄 - and to avoid dig deeper into the libs/depencencies rabbit hole.
đŸ€” 1
Components are basically namespace packages (and not “libraries”)
For third-party packages (aka libs) you should be able to use the features of pantsbuild.
I hope I clarified a bit, if not please let me know!
The component metadata (the Clojure link): that is about third-party dependencies/libraries - and that part is Clojure only. The component itself is defined in the project(s) that need it. It can depend on other components (that also are defined in the projects that need them), this is how you would develop features: combining the Lego bricks into something useful. This part works the same in Clojure and Python. This part is what I meant by the ecosystem support.
What’s missing here is a Pants-aware version of Polylith, that lets Pants figure out the dependencies. I will give this some thought, I think it makes sense because that’s how the tooling has been developed since the beginning: on top of other tools (like Poetry, Hatch, PDM and Rye).
f
Yeah that might be interesting. What actually draws me to Polylith is the coarser-grained dependency model, which I think is a bit easier for developers to grok as codebases than Pants fine-grained file-based one. Polylith+Pants seems to be an interesting combination specifically because it tries to impose an architectural model over the (anxiety-inducing) freedom that Pants permits 🙂
😄 1
b
Hello again, I want to share an update about Polylith: it now has support for tools like Pixi, that bridges the gap beween pip and Conda. I hope this addition will make it possible for even more Python teams out there to try out the Polylith Architecture.