Skip to main content

Python tooling for Polylith

A command line interface that adds tooling support for the Polylith Architecture in Python.

Documentation

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

Quick start

Poetry user? For Poetry, the recommended setup is to install the poetry-polylith-plugin. Read more about Poetry in the documentation.

Setup for Hatch users

Create a directory for your code, initialize it with git and setup the basics with hatch:

git init

hatch new --init

Add the Polylith CLI as a dev dependency in pyproject.toml:

[tool.hatch.envs.default]
dependencies = ["polylith-cli"]

Add configuration for a local virtual environment in the pyproject.toml:

[tool.hatch.envs.default]
type = "virtual"
path = ".venv"
python = "3.12"  # your preferred version here

Make Hatch aware of the Polylith structure, by adding this to the pyproject.toml:

[tool.hatch.build]
dev-mode-dirs = ["components", "bases", "development", "."]

Next: create a Polylith workspace, with a basic Polylith folder structure. The poly command is now available in the local virtual environment. You can run commands in the context of hatch run to make Polylith aware of the development environment.

hatch run poly create workspace --name my_namespace --theme loose

Ready for coding!

Add components, bases and projects:

hatch run poly create component --name my_component

hatch run poly create base --name my_example_endpoint

hatch run poly create project --name my_example_project

For details, have a look at the documentation. There, you will find guides for setup, migration, packaging, available commands, code examples and more.

Setup for PDM users

Create a directory for your code, initialize it with git and setup the basics with PDM.

git init

pdm init -n --backend pdm-backend minimal

Add a workspace hook

Make PDM aware of the Polylith structure, by adding the pdm-polylith-workspace hook to the newly created pyproject.toml.

The build hook will add an additional pth file to the virtual environment, with paths to the Polylith source code folders (bases, components).

[build-system]
requires = ["pdm-backend", "pdm-polylith-workspace"]
build-backend = "pdm.backend"

Add the polylith-cli

Add the Polylith CLI as a dev dependency and setup the virtual environment paths.

touch README.md

pdm add -d polylith-cli

pdm install

Next: create a Polylith workspace, with a basic Polylith folder structure. The poly command is now available in the local virtual environment. You can run commands in the context of pdm run to make Polylith aware of the development environment.

pdm run poly create workspace --name my_namespace --theme loose

Ready for coding!

Add components, bases and projects:

pdm run poly create component --name my_component

pdm run poly create base --name my_example_endpoint

pdm run poly create project --name my_example_project

Setup for Rye users

rye init my_repo  # name your repo

cd my_repo

rye add polylith-cli --dev

rye sync  # create a virtual environment and lock files

Create a workspace, with a basic Polylith folder structure.

rye run poly create workspace --name my_namespace --theme loose

Setup for uv users

uv init -name my_repo  # name your repo

cd my_repo

uv add polylith-cli --dev

uv sync  # create a virtual environment and lock files

Create a workspace, with a basic Polylith folder structure.

uv run poly create workspace --name my_namespace --theme loose

Rye and uv users: edit the configuration

The default build backend for Rye and uv is Hatch. Make Rye and uv (and Hatch) aware of the way Polylith organizes source code:

[tool.hatch.build]
dev-mode-dirs = ["components", "bases", "development", "."]

Run the sync command to update the virtual environment:

Rye:

rye sync

uv:

uv sync

Finally, remove the src boilerplate code that was added by Rye and uv in the first step:

rm -r src

Rye and uv users: ready for coding!

Add components, bases and projects:

Rye:

rye run poly create component --name my_component

rye run poly create base --name my_example_endpoint

rye run poly create project --name my_example_project

uv:

uv run poly create component --name my_component

uv run poly create base --name my_example_endpoint

uv run poly create project --name my_example_project

For details, have a look at the documentation. There, you will find guides for setup, migration, packaging, available commands, code examples and more.

Metadata

Release files for polylith-cli 1.51.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polylith-cli 1.51.0
File Size Uploaded Provenance Actions
polylith_cli-1.51.0.tar.gz 100.4 kB Without provenance Details for polylith_cli-1.51.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polylith-cli 1.51.0
File Interpreter ABI Platform Actions
polylith_cli-1.51.0-py3-none-any.whl Python 3 none any Details for polylith_cli-1.51.0-py3-none-any.whl

Total release size: 271.0 kB

Release files / polylith_cli-1.51.0.tar.gz

Download URL polylith_cli-1.51.0.tar.gz
Size 100.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9572658af3bd1516e5e562c97b02b7fa68309f1c25a1dc4a2ee1ebe834b096b2
BLAKE2b-256 checksum
How to use checksums
9bb6455e73c1c2be14c8e68526a2ca8b4cbd7f46a93a7f67f465657b013661bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / polylith_cli-1.51.0-py3-none-any.whl

Download URL polylith_cli-1.51.0-py3-none-any.whl
Size 170.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f100226b50899b94a4b901be1688faa06d526251a54e5c3089c241a81a6c4a41
BLAKE2b-256 checksum
How to use checksums
6e29c1a470dc2a452ef9e111a9e730824ff895410ed9c59a0fc5dad50fafbfda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for polylith-cli 1.51.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.51.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page