polylith-cli

1.26.0last stable release 2 months ago
Complexity Score
Low
Open Issues
1
Dependent Projects
0
Weekly Downloadsglobal
7,669

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

:sparkles: Python tools for the Polylith Architecture :sparkles:

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.

What’s Polylith? :thinking:

… 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 :thumbsup:

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 :books:

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

Python Monorepos with Polylith :snake:

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

  • 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 tooling support to Poetry. The CLI adds tooling support for several Package & Dependency Managers (such as Hatch, PDM, Rye, 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).

:sparkles: Examples and Production systems :sparkles:

There’s example Polylith repositories for:

  • Poetry
  • Hatch
  • PDM
  • Rye
  • Pants
  • uv

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

  • 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

Talks

  • PyCon DE & PyData Berlin 2024 - Python Monorepos: The Polylith Developer Experience (about 29 minutes)
  • 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)

Podcasts

  • Talk Python To Me: Monorepos in Python

Articles

  • 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

Repo Visualization

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

Dependencies

CVE IssuesActive
0
Scorecards Score
No Data
Test Coverage
No Data
Follows Semver
Yes
Github Stars
413
Dependenciestotal
4
DependenciesOutdated
0
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No

Learn how to distribute polylith-cli in your own private PyPI registry

pip install polylith-cli
Processing...
Done

59 Releases

PyPI on Cloudsmith

Getting started with PyPI on Cloudsmith is fast and easy.