Skip to content

Inspired by the poetry-monorepo-dependency-plugin, this uv geared tool facilitates the usage of more complex monorepo project structures by pinning version dependencies when building archives with local path dependencies to other uv projects within the same monorepo.

License

Notifications You must be signed in to change notification settings

TechnologyBrewery/uv-monorepo-dependency-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uv-monorepo-dependency-tool

PyPI PyPI - Python Version PyPI - Wheel PyPI - Downloads License Build (github)

Inspired by the poetry-monorepo-dependency-plugin, this uv geared tool facilitates the usage of more complex monorepo project structures by pinning version dependencies when building archives with local path dependencies to other uv projects within the same monorepo.

Installation

uv tool install rewrite-path-dependencies

Usage

During archive building, this tool will rewrite path dependencies to other uv projects using the corresponding pinned version dependency extracted from the referenced project's pyproject.toml. By referencing pinned version dependencies in published archive files, package consumers may more easily depend on and install packages that are built within complex monorepos, without needing to replicate the exact folder structure utilized within the monorepo for that project's dependencies.

For example, assume that project-a and project-a-consumer are uv projects that exist within the same monorepo and use the following pyproject.toml configurations.

project-a/pyproject.toml:

[project]
name = "project-a"
version = "1.0.0.dev0"

project-a-consumer/pyproject.toml:

[project]
name = "project-a-consumer"
version = "1.0.0.dev0"
dependencies = ["project-a"]

[tool.uv.sources]
project-a = { path = "../project-a", editable = true }

When generating wheel or sdist archives for the project-a-consumer project through rewrite-path-dependencies build, the corresponding package-a-consumer source distribution will be constructed as if its dependency on the project-a project were declared as project-a = "1.0.0.dev0". As a result, package metadata in archives for project-a-consumer will shift from Requires-Dist: project-a to Requires-Dist: project-a=="1.0.0.dev0".

Command line mode

To run this tool via the command line, within the desired package directory run uv tool run rewrite-path-dependencies build.

Licence

uv-monorepo-dependency-tool is available under the MIT licence.

About

Inspired by the poetry-monorepo-dependency-plugin, this uv geared tool facilitates the usage of more complex monorepo project structures by pinning version dependencies when building archives with local path dependencies to other uv projects within the same monorepo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages