Skip to content

DavidVujic/python-polylith

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

263 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

โœจ Python tools for the Polylith Architecture โœจ

A repo containing tooling support for the Polylith Architecture in Python.

The main use case is to support having one or more microservices (or apps) in a Monorepo, and share code between the services.

DavidVujic

CodeScene Code Health

Quality Gate Status

Download Stats

Download Stats

What's Polylith? ๐Ÿค”

... Polylith is a software architecture that applies functional thinking at the system scale. It helps us build simple, maintainable, testable, and scalable backend systems. ... (from the Polylith Architecture docs)

Polylith is an architecture, with tooling support, that was originally built for Clojure. This repo brings Polylith to Python.

Polylith is using a components-first architecture. You can think of it as building blocks, very much like LEGO bricks. All code lives in a Monorepo, available for reuse. Python code - the bricks - is separated from the infrastructure and the actual building of artifacts.

Use cases

Microservices and apps ๐Ÿ‘

The main use case is to support having one or more microservices (or apps) in a Monorepo, and share code between the services.

Libraries

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.

Documentation ๐Ÿ“š

Have a look at the Python-specific documentation. You will find installation, setup, usage guides, examples and more.

Python Monorepos with Polylith ๐Ÿ

You can use Polylith with Poetry, Hatch, PDM, Rye, Maturin, Pixi, uv and Pantsbuild. This repo contains a Poetry plugin, a standalone CLI and build hooks.

The Poetry plugin adds tooling support to Poetry. The CLI adds tooling support for several Package & Dependency Managers (such as Hatch, PDM, Rye, Maturin, Pixi and uv).

The Hatch Build Hook adds build-specific support (also for uv, Rye, Pixi and Pantsbuild, using hatchling as the build backend). The PDM Build Hook for projects adds build-specific support for 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).

โœจ Examples and Production systems โœจ

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.

There's more examples and production systems in the documentation.

Videos

Talks

Guides

Podcasts

Articles

Repo Visualization

A visualization of this repo (that itself is a Polylith workspace) using the poly info command.

poly-info