Repository navigation
Description
Current state
The root pyproject.toml is a tooling-only pseudo-project (citry-monorepo, marked non-releasable) with dev/ci extras. There is no [tool.uv.workspace], so uv does not know packages/py/* are projects:
packages/py/citry_core(maturin) is installed by hand:uv run maturin develop, both locally and in CI (.github/workflows/py--tests.yml).packages/py/citry(setuptools, pure Python) is installed by hand:uv pip install -e packages/py/citry(docs/codebase.md). The CI workflow currently has no install step for it at all, so its test suite only runs locally.uv.lockcovers only the root tooling dependencies; package dependencies are unlocked.
This causes three concrete problems:
uv runis a footgun. A bareuv runre-syncs the environment against the lockfile, which knows nothing about the manually installed editable packages, so it can remove or break them. Everyone has to remember.venv/bin/...oruv run --no-sync.- Test dependencies must be declared twice. A package's test dep (e.g.
pytest, and nowpydanticfor the Kwargs/Slots-as-Pydantic-models tests) lives in the package's[dependency-groups].dev(the semantic owner) AND mirrored in the root extras (the thing the shared venv and CI actually install from). The mirror comments in both pyprojects point at each other, but it is still drift waiting to happen. - Bootstrap is multi-step and undocumented-by-tooling. A fresh clone needs
uv sync --extra dev, thenmaturin developin citry_core, thenuv pip install -ein citry, in the right order.
Proposal
Make the root a uv workspace and let uv sync own the whole environment:
# root pyproject.toml
[tool.uv.workspace]
members = ["packages/py/*"]
[tool.uv.sources]
citry = { workspace = true }
citry-core = { workspace = true }citry's dependencycitry-core>=1.3.0resolves to the workspace member during development (via the source entry) while remaining a normal PyPI range for publishing.- Convert the root
dev/ciextras to PEP 735[dependency-groups](uv installs thedevgroup by default onuv sync). Keep only genuinely repo-wide tooling there (ruff, mypy, maturin, pre-commit); delete the mirrored test deps (pytest,pydantic) so each package's[dependency-groups].devis the single declaration. - Dev bootstrap becomes:
uv sync --all-packages(members install editable automatically).uv runbecomes safe, since the lockfile knows about every package. uv.lockthen covers all package dependencies, making CI reproducible (uv sync --locked).
The maturin member wrinkle
citry_core builds a Rust extension. With it as a workspace member, uv sync builds it through the maturin PEP 517 backend, but uv's rebuild detection is keyed on package metadata, not Rust sources, so editing crates/** would not trigger a rebuild on the next sync. Two mitigations to evaluate:
[tool.uv] cache-keyson citry_core with file globs over the Rust sources (note they live OUTSIDE the package dir, undercrates/), souv syncrebuilds when Rust changes.- Keep
maturin developas the documented inner-loop command for Rust work, withuv synchandling everything else. (Either way, keep the docs/codebase.md note that benchmarking needs--release; check what profile the PEP 517 editable build uses, since a debug build silently skewed benchmarks once already.)
Migration steps
- Add the workspace + sources tables to the root pyproject; commit the citry package's pyproject (currently untracked) so it can be a member.
- Move mirrored test deps out of the root extras; convert extras to dependency-groups.
- Solve the citry_core rebuild story (cache-keys vs documented
maturin develop); verify the editable build profile. uv lock, commit the expandeduv.lock.- Update CI (
py--tests.yml):uv sync --locked --all-packages --group ci, drop the manual maturin step if cache-keys covers it (keepSwatinem/rust-cache), thenuv run --no-sync pytest. This also closes the gap where the citry package's tests do not run in CI. Consider pinning the uv version once the lockfile carries this much weight. - Update docs/codebase.md (dev setup, running tests) and remove the mirror comments from both pyprojects.
- Verify the release flows still work per package:
maturin publishfor citry_core (tag-driven workflow),uv build --package citryfor the pure-Python package.
Acceptance criteria
- Fresh clone:
uv sync --all-packagesproduces a venv where everypackages/py/*package imports anduv run pytestcollects and passes all package test suites. - Bare
uv runno longer breaks the environment. - Each test dependency is declared exactly once, in the owning package.
- CI runs the citry package's tests and installs from the lockfile.
Refs: root pyproject.toml, packages/py/citry/pyproject.toml, packages/py/citry_core/pyproject.toml, .github/workflows/py--tests.yml, docs/codebase.md ("Development setup", "Running tests").
Activity
JuroOravec commentedon Jun 30, 2026
Implemented in 08570f6