A uv tool for facilitating 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.
Project description
uv-monorepo-dependency-tool
Overview
The uv-monorepo-dependency-tool is designed to simplify dependency management in monorepos that utilize path dependencies. It streamlines the process of building archives by rewriting path dependencies to reference the appropriate pinned version dependencies from the referenced project's pyproject.toml.
This helps package consumers avoid replicating complex folder structures within their own projects. Instead, they can directly rely on the pinned version dependencies specified during the archive-building process.
Features
- Automated Rewrite of Path Dependencies: Converts editable path dependencies into pinned version dependencies during archive generation.
- Improved Package Metadata: Adjusts dependency metadata in generated archives to use pinned versions, ensuring better compatibility for consumers of the package.
- Monorepo Support: Designed specifically for managing dependencies across complex UV-based monorepos.
- CLI Support: Run commands directly from the terminal for seamless integration with your development workflow.
Getting Started
Installation
To use this tool in your environment, from the root project directory run
#TODO: update to published package
uv tool install uv-monorepo-dependency-tool/dist/uv_monorepo_dependency_tool-1.0.0.dev0-py3-none-any.whl
Usage
The uv-monorepo-dependency-tool works during the archive-building process. It analyzes pyproject.toml files of dependencies in the monorepo and replaces editable path dependencies with the corresponding pinned version 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 project-a-consumer via build-rewrite-path-deps, 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 execute the tool from the command line, navigate to the desired package directory and run the following command:
uv tool run uv-monorepo-dependency-tool build-rewrite-path-deps --version-pinning-strategy=mixed
This will generate the updated archive with the rewritten dependencies.
Configuration
The following cli options are supported :
* `--version-pinning-strategy` (`string`, default: `mixed`, options: `mixed`, `exact`): Strategy by which path
dependencies to other Poetry projects will be versioned in generated archives. Given a path dependency to a Poetry project
with version `1.2.3`, the version of the dependency referenced in the generated archive is `=1.2.3` for `exact`. `mixed` mode switches versioning strategies based on whether the dependency
UV project version is an in-flight development version or a release - if a development version (i.e. `1.2.3.dev456`),
`mixed` can be used to specify the inclusion of subsequent dev releases (i.e. `>=1.2.3.dev`), and
if a release version (i.e. `1.2.3`), `exact` is applied (i.e. `=1.2.3`).
Licence
uv-monorepo-dependency-tool is available under the MIT licence.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uv_monorepo_dependency_tool-1.0.1.tar.gz.
File metadata
- Download URL: uv_monorepo_dependency_tool-1.0.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef2845f77759dc97383b1d72ded5f31163eca69a1734f099e7617f4380939fd
|
|
| MD5 |
6a7b4ee020fd1331ac4022a9a05082ae
|
|
| BLAKE2b-256 |
a5c19c97b4058a3856a287a4bb6176fa7ad1da0854586afe4348d3458eec4b89
|
File details
Details for the file uv_monorepo_dependency_tool-1.0.1-py3-none-any.whl.
File metadata
- Download URL: uv_monorepo_dependency_tool-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53892f31d20ebdac9d762ca7fe8faa810e8d4ef06ae69fddc163ed0a3716dafe
|
|
| MD5 |
4e670f5cc3558b03358f97aa2491092a
|
|
| BLAKE2b-256 |
233140f378894a7ae4a50644c20ad721f6ddaf456d2f6f109349429656551790
|