A fresh take on monorepos in Python

Again, I find myself copying Python code into a new repo. It’s the third time I do this. The code snippet is too tiny to even bother packaging as a library, but still very useful in many of our micro services.

"What if we had Polylith in Python. I would add an existing component. Just like LEGO.”

It seems to be a trend towards developing micro services that are separated into different repos. On the other hand, it also seems to be a trend in going the opposite way. Organizing code in a single repo.

Separate repos to separate services is a good idea, but might introduce headache: versioning, backwards compatibility, keeping dependencies up to date, duplicating deployment infrastructure and duplication of source code. These things can be solved by using a monorepo.

A monorepo will introduce a different set of problems. Is it possible to share code between services in a monorepo, without hacks or awkward git features? Well, there’s a thing called Polylith. Coming from the Clojure community, Polylith is an architecture that focuses very much on the developer experience. The Polylith architecture has a simplistic and developer friendly approach to sharing code between projects.

And now we have that in Python! The Poetry Polylith Plugin brings the needed tooling support to Python, and is an Open Source project that I am the maintainer of. In this presentation I will live code & demo the features of Polylith, making the Developer Experience joyful.