Python Monorepos
Utilities for working with monorepos in Python.
Installation
uv init --package
uv add uvmono
uv run uvmono --help
Usage
# Show help
uvmono --help
# List all packages in the monorepo
uvmono list
# Add a package to the monorepo
uvmono new <package-name>
# Add dev-containers for a package in the monorepo (optionally for all packages)
uvmono add-devcontainer <package-name> [--all]
# Create a Matrix Strategy for a GitHub Actions workflow
# The key is the key for the matrix strategy in the GitHub Actions workflow `matrix.<key-name>.path`
uvmono matrix_strategy <key>
# Returns a JSON object with the matrix strategy for the packages in the monorepo:
# {
# "matrix": {
# <key>: [
# {
# "path": "packages/package1",
# "name": "package1",
# "dependencies": ["package2"],
# "filter": "..." # outputs `is_changed` in dorny/paths-filter@v3
# },
# ...
# ]
# }
# }
Examples
List all packages in the monorepo
uvmono list
Add a package to the monorepo
Create a new package in the monorepo with the name my-package.
uvmono new my-package
This will automatically create a new directory packages/my-package with the following structure:
.
└── packages/my-package
├── src
│ └── my_package
│ └── __init__.py
├── tests
│ ├── __init__.py
│ ├── conftest.py
│ └── test_main.py
├── pyproject.toml
└── README.md
Create a Matrix Strategy for a GitHub Actions workflow
Create a matrix strategy for a GitHub Actions workflow with the key inputs.
uvmono matrix_strategy inputs
This will automatically generate a matrix strategy for the packages in the monorepo, which can be used in a GitHub Actions workflow:
name: CI
on:
pull_request:
branches:
- main
jobs:
build_matrix:
name: Build Package Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix_strategy.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install the project
run: uv sync --all-extras --dev
- name: Create Package Matrix
id: matrix_strategy
run: uv run uvmono matrix_strategy inputs
test_package:
runs-on: ubuntu-latest
needs: build_matrix
strategy:
matrix: ${{ fromJson(needs.build_matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Print Inputs
run: |
echo "Path: ${{ matrix.inputs.path }}"
echo "Name: ${{ matrix.inputs.name }}"
echo "Shared: ${{ matrix.inputs.shared }}"
- name: "Check if ${{ matrix.inputs.name }} has changed"
uses: dorny/paths-filter@v3
id: changes
with:
filters: ${{ matrix.inputs.filter }}
...
Metadata
Release files for uvmono 0.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uvmono-0.3.9.tar.gz | 39.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uvmono-0.3.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.2 kB
Release files / uvmono-0.3.9.tar.gz
| Download URL | uvmono-0.3.9.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a18079f9b4b5db2b3d0e1f6a853ae0d0d505101344764453911d64a4b27f49f8
|
|
BLAKE2b-256 checksum How to use checksums |
15cb66b523feecdb51983bb9a648d1c03a07d67437339cf9f4cb21ea7d47529a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 12, 2025.
Transparency logRelease files / uvmono-0.3.9-py3-none-any.whl
| Download URL | uvmono-0.3.9-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39a18b5e6bb3b07e9aed6ea6d62d6a4f920e527271ecc0caf3e5bb85a10c6676
|
|
BLAKE2b-256 checksum How to use checksums |
0a389ecb5d8dbc102f8765abb277299921f829079d084ce7a0c6fcb3493c5723
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 12, 2025.
Transparency log