Bough
bough is a tool to determine which uv workspace packages need building or testing based on git changes.
Problem
When using uv workspaces, it's often unclear which packages are affected by a given change. This leads to either rebuilding everything (wasteful) or missing necessary rebuilds (broken deployments).
Solution
Analyze dependencies and git diffs to identify affected packages, then build only what's needed.
Usage
bough
# Custom base commit
bough --base main analyze
# Display dependency graph
bough graph
# Output GitHub Actions matrix format
bough --format github-matrix analyze
Examples
my-app/
├── pyproject.toml
├── packages/
│ ├── auth/ # library (no deps)
│ ├── database/ # library (no deps)
│ └── shared/ # library (depends on: database)
└── apps/
├── api/ # buildable (depends on: auth, database, shared)
└── web/ # buildable (depends on: shared)
Graph
The bough graph command shows the dependency relationships between packages:
🚀 Buildable Packages:
==================================================
📦 api (apps/api)
└─ depends on: auth, database, shared
📦 web (apps/web)
└─ depends on: shared
📚 Library Packages:
==================================================
📖 auth (packages/auth)
├─ depends on: (none)
└─ depended on by: api
📖 database (packages/database)
├─ depends on: (none)
└─ depended on by: api, shared, web
📖 shared (packages/shared)
├─ depends on: database
└─ depended on by: api, web
Analyze
The bough analyze command shows what packages should be built based on what files have changed.
GitHub Matrix (for parallel CI jobs):
{
"include": [
{"package": "api", "directory": "apps/api"},
{"package": "web", "directory": "apps/web"}
]
}
Text (default):
Packages to rebuild:
api (apps/api)
web (apps/web)
Changed files:
packages/database/models.py
Configuration
.bough.yml:
# Packages that produce build artifacts (default: ["apps/*"])
buildable:
- "apps/*"
# Files that never trigger rebuilds
ignore:
- "*.md"
- "docs/**"
GitHub Actions Integration
See GitHub Actions Integration Guide for examples of using Bough in CI/CD pipelines.
How It Works
- Find all workspace members from
pyproject.toml - Build dependency graph from
tool.uv.sources - Detect changed files with git diff
- Apply change detection rules:
- File changed inside package → package directly affected
- File changed at workspace root → all packages affected
- Calculate transitive impacts (if A depends on B and B changes, A is affected)
- Filter to only buildable packages
- Output build list
If packages/database/models.py changes:
databaseis directly affectedsharedis affected (depends on database)apiis affected (depends on database and shared)webis affected (depends on shared)- Output shows only
apiandweb(they're buildable)
Non-Goals
This tool is intentionally simple:
- Not a build system (like Bazel or Buck)
- Not a task runner
- Not multi-language aware
- Not trying to optimize build order or parallelization
- Not caching build artifacts
Prior Art
- una - Unify Python packaging commands
- postmodern-mono - Python monorepo example
- Nx affected - Similar concept for JS/TS monorepos
- Turborepo --affected - Git-based filtering for builds
Roadmap
- setup a release workflow to pypi
- provide an option that outputs all affected packages, not just buildable ones (useful for selectively running tests)
- handle working tree changes
- add a contributing guide
- check in a sample configuration file and document the defaults better
- improve or remove the github actions examples
Metadata
Release files for bough 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bough-0.3.4.tar.gz | 41.9 kB | Without provenance | Details for bough-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bough-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for bough-0.3.4-py3-none-any.whl |
Total release size: 52.0 kB
Release files / bough-0.3.4.tar.gz
| Download URL | bough-0.3.4.tar.gz |
|---|---|
| Size | 41.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee459357a444a635b728ab410330d925d1625781f60881686e9779906ddc42bb
|
|
BLAKE2b-256 checksum How to use checksums |
2a05c58ce61bbbf8697104fe49f87ce4a923c5e67f9fd0b03d4cb0a13104e352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bough-0.3.4-py3-none-any.whl
| Download URL | bough-0.3.4-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fa65ebd23521d465b547a729f6d81a46827eb72b93c78b4e3af0f744550e5b2
|
|
BLAKE2b-256 checksum How to use checksums |
97baa99287cbd6c7d1acbf88f814b0dca20f655cea333a57190bd549f93751ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bough 0.3.4
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.