astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26.46k stars 770 forks source link

Add all packages from git-backed virtual workspace as a single source #8735

Open mjclarke94 opened 2 weeks ago

mjclarke94 commented 2 weeks ago

We are trying to centralise all of our libraries in a mono-repo, some of which are interdependent.

[project]
name = "test"
version = "0.1.0"
requires-python=">=3.12"
dependencies = [
"c",
"d"
]

[tool.uv.sources]
c = { git = "https://github.com/astral-sh/workspace-virtual-root-test", subdirectory = "packages/c" }
d = { git = "https://github.com/astral-sh/workspace-virtual-root-test", subdirectory = "packages/d" }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Rather than needing to add each subdirectory as a source, it would be nice to be able to add all the modules belonging to a virtual workspace as one source which exposes multiple packages.

[tool.uv.sources]
{ git_workspace = "https://github.com/astral-sh/workspace-virtual-root-test" }

EDIT: Realised that 0.42.9 fixed my original issue so turning it from a two parter into a more targeted request!

elupus commented 1 week ago

Ran into this need aswell. Was trying to move away from hatch relative packages. But the resolver did not like just pointing to a workspace package in a git repo with sub directory packages as workspace members.

You really just want to specify the git path and revision once for the full workspace set.