astral-sh / uv

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

Docs request: Workspaces -- do we add `albatross` to `tool.uv.sources` #6786

Open jamesbraza opened 3 weeks ago

jamesbraza commented 3 weeks ago

With uv==0.4.0 looking at https://docs.astral.sh/uv/concepts/workspaces/#workspace-layouts, it details:

The docs don't mention if:

The below is what I got working, but it does not match the example shown here: https://docs.astral.sh/uv/concepts/workspaces/#workspace-sources

[tool.uv.sources]
bird-feeder = {workspace = true}
albatross = {workspace = true}

[tool.uv.workspace]
members = ["packages/*"]

More specifically, albatross = {workspace = true} is not shown in the docs. But when I remove it and run uv lock, I get:

error: Failed to build: `aviary-hotpotqa @ file:///path/to/repo/packages/bird-feeder`
  Caused by: Failed to parse entry for: `albatross`
  Caused by: Package is not included as workspace package in `tool.uv.workspace`
charliermarsh commented 3 weeks ago

What do you have in the pyproject.toml for file:///path/to/repo/packages/bird-feeder?

jamesbraza commented 3 weeks ago

Here is that pyproject.toml:

[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64", "setuptools_scm>=8"]

[project]
dependencies = [
    "albatross",
]
dynamic = ["version"]
name = "bird-feeder"
requires-python = ">=3.11"

[tool.ruff]
extend = "../../pyproject.toml"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
root = "../.."
version_file = "src/bird-feeder/version.py"
charliermarsh commented 3 weeks ago

Cool, so in that pyproject.toml, you should include:

[tool.uv.sources]
albatross = { workspace = true }

The sources should be defined wherever the dependencies are included. Does that make sense?

jamesbraza commented 3 weeks ago

Yeah that makes sense! Thanks for working through it

I think then we should update the example pyproject.toml's in https://docs.astral.sh/uv/concepts/workspaces/#getting-started to include that

charliermarsh commented 3 weeks ago

Good idea!