Skip to main content

Add your description here

Project description

Python Monorepos

Utilities for working with monorepos in Python.

Installation

git clone https://github.com/JenspederM/uvmono
cd uvmono
pip install .

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
uvmono add-devcontainer <package-name>

# Add dev-containers for all packages in the monorepo
uvmono add-devcontainer --all

# Create a Matrix Strategy for a GitHub Actions workflow
uvmono matrix_strategy <key-name>
# Returns a JSON object with the matrix strategy for the packages in the monorepo:
# {
#   "matrix": {
#     "inputs": [ 
#       { 
#           "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: |
            is_changed:
              - '${{ matrix.inputs.path }}/**'
            is_shared_changed:
              - 'packages/shared/**'
      ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uvmono-0.2.1.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uvmono-0.2.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file uvmono-0.2.1.tar.gz.

File metadata

  • Download URL: uvmono-0.2.1.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for uvmono-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d8625c19a9ad8f05bb0d34ac502ee5164b135c8bbb06905e2062ef28555ef04a
MD5 1e3d99cf89392543c7ddc2e232bf52cd
BLAKE2b-256 8ae366eb9d981df036085136d899c8147d5ea909ce856f57c1a8fd27106b8128

See more details on using hashes here.

Provenance

The following attestation bundles were made for uvmono-0.2.1.tar.gz:

Publisher: publish.yml on JenspederM/uvmono

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uvmono-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: uvmono-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for uvmono-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99174885e04a8867188cdcf0ed7016aa756b64fe1a48bfabdbf7eb364e7992ae
MD5 5e6b8f191a01907742d659d5ab9d81d8
BLAKE2b-256 a7297336904c84f309f3bb4afafa8d9e4c45294ae7405da214e28f3ed4e92d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for uvmono-0.2.1-py3-none-any.whl:

Publisher: publish.yml on JenspederM/uvmono

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page