Skip to content

Python version constraint is not observed when building non-workspace package that depends on workspace packages #9832

@imrehg

Description

@imrehg

I'm trying a setup, when the workspace has a requires-python value while a non-workspace has a different (more loose) constraints, but requires a package from the workspace. It seems like when I installing that latter, non-workspace package, the workspace requires-python is not being observed.

I've set up a project pretty much exactly as it's described in the workspace documentation:

  • albatros is root
  • bird-feeder is a workspace package`,
  • seeds is an excluded package, but it depends on bird-feeder

This latter is set up like this

# ... snip
dependencies = ["bird-feeder"]

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

Then:

  • albartros sets requires-python = '>=3.13'; this applies to bird-feeder as well
  • seeds sets requires-python = '>=3.10' and is not part of the workspace

Here's the test setup as a repo: https://github.com/imrehg/uv-workspace-debug

Expected behaviour

seeds wouldn't install with Python 3.10/11/12, only with 3.13, due to the bird-feeder requirement, that should force the workspace's 3.13 Python requirements

Observed behaviour

seeds happily installs with 3.10, including

cd packages/seeds
❯ uv sync --python 3.10
Resolved 2 packages in 565ms
   Built bird-feeder @ file:///Users/gergely/prog/uvworkspace/albatros/packages/bird-feeder
   Built seeds @ file:///Users/gergely/prog/uvworkspace/albatros/packages/seeds
Prepared 2 packages in 578ms
Uninstalled 2 packages in 3ms
Installed 2 packages in 3ms
 ~ bird-feeder==0.1.1.dev2+g59d56f9.d20241212 (from file:///Users/gergely/prog/uvworkspace/albatros/packages/bird-feeder)
 ~ seeds==0.1.0 (from file:///Users/gergely/prog/uvworkspace/albatros/packages/seeds)

While going into bird-feeder folder to install just that:

cd ../bird-feeder
❯ uv sync --python 3.10
Using CPython 3.10.15
error: The requested interpreter resolved to Python 3.10.15, which is incompatible with the project's Python requirement: `>=3.13`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions