A repo containing tooling support for the Polylith Architecture in Python.
Polylith is an architecture (with tooling support) originally built for Clojure. The code in this repo brings Polylith to Python.
From the official Polylith Architecture docs:
... Polylith is a software architecture that applies functional thinking at the system scale. It helps us build simple, maintainable, testable, and scalable backend systems. ...
Polylith is using a components-first architecture. Similar to LEGO, components are building blocks. A component can be shared across apps, serverless functions and microservices.
Have a look at the Python-specific documentation. You will find installation, setup, usage guides and more.
This repo contains a Poetry plugin, a CLI that enables support for Hatch, PDM, Rye and Pantsbuild. There's a Hatch Build Hook plugin and a PDM build hooks to fully support these tools.
- a Poetry Plugin
- a CLI
- a Hatch Build Hook
- a PDM Build Hook for projects
- a PDM Build Hook for the workspace
The Poetry plugin adds Polylith specific tooling support to Poetry. The CLI adds tooling support for Polylith, and enables different kinds of Package & Dependency Management tools (such as Hatch and PDM).
The Hatch Build Hook adds support for building Libraries from Polylith with Hatch (and Rye, using hatchling as a build backend by default).
The PDM Build Hook for projects add support for building apps, services and libraries from Polylith using PDM. The PDM Build Hook for the workspace makes the virtual environment aware of the way Polylith organizes code (i.e. the bases and components folders).
The main use case is to support having one or more microservices (or apps) in a Monorepo, and share code between the services.
Polylith for Python has support for building libraries to be published at PyPI, even if it isn't the main use case. More details about how to package libraries in the docs about Packaging & deploying.
There's example Polylith repositories for:
The repositories are example Python setups of the Polylith Architecture.
You will find examples of sharing code between different kind of projects,
and developer tooling setup such as mypy
and the venv
.
- Python with the Polylith Architecture - an overview (about 15 minutes)
- Python Poetry Polylith Plugin - the tooling support & commands (about 13 minutes)
- The Developer Experience
- developing a Dad Joke Service with Polylith (about 27 minutes)
- the Polylith Dev Experience using Hatch and Rye (about 7 minutes)
- The standalone Polylith CLI - An intro to the polylith-cli - tooling support for Polylith with Python and Hatch
- Python Web Conference 2023 - Microservices, Monolith, Monorepos: the differences & how nicely Polylith solves the trade offs - A Fresh Take on Monorepos in Python (about 36 minutes)
- Talk Python To Me: Monorepos in Python
- The last Python Architecture you will ever need?
- A Fresh Take on Monorepos in Python
- A simple & scalable Python project structure
- Aws CDK App with polylith code architecture by Yoel Benítez Fonseca
- GCP Cloud Functions with Python and Polylith
- Python FastAPI Microservices with Polylith
- Kafka messaging with Python & Polylith
- Runestone Monorepo and Server Structure by Minh-Thao Pham
- Python Monorepo Visualization
A visualization of this repo (that itself is a Polylith workspace) using the poly info
command.