Skip to content

Transitive workspace dependencies with dynamic package versioning #8802

@ajohnson5

Description

@ajohnson5

UV Version

0.4.29

Issue

Currently I am experiencing an issue with transitive dependencies in workspaces when using a dynamic version. I have created a minimal example with a fork of https://github.com/konstin/workspace-git-path-dep-test. The fork is here https://github.com/ajohnson5/workspace-git-path-dep-test/tree/dynamic-version.

I am trying to import two modules (which are workspaces), one of which depends on the other, similar to packages c and d (in the above) into another repository.

Reproduction

In the above fork there are two branches:

  1. static-version: Same as the main branch with each package having an explicit version number defined in their pyproject.toml files such as version="0.1.0".
  2. dynamic-version: Each package has a dynamic version, similar to below with a __about__.py file in the root of the project. In this file we have __version__=="1.0.0"
[project]
name = "d"
dynamic=["version"]

[tool.hatch.version]
path = "../../__about__.py"

Now in a different project, I am trying to import both packages c and d. The pyproject.toml is shown below:

[project]
name = "example-project"
version = "0.1.0"
requires-python=">=3.11, <=3.12"

dependencies = [
  "c",
  "d",
]

[tool.uv.sources]
c = { git = "https://github.com/ajohnson5/workspace-git-path-dep-test.git", subdirectory="packages/c", branch="dynamic-version"}
d = { git = "https://github.com/ajohnson5/workspace-git-path-dep-test.git", subdirectory="packages/d", branch="dynamic-version"}


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

[tool.hatch.build.targets.wheel]
packages = ["src/example_project"]

Note that between any uv commands I am doing a complete fresh run, uv cache clean, rm -rf .venv and removing the uv lock.
If I use the dynamic-version branch I get the following error when running uv sync or uv lock

error: Requirements contain conflicting URLs for package `d`:
- file:///Users/a-user/.cache/uv/git-v0/checkouts/c63672d311baa9b4/d116d88/packages/d
- git+https://github.com/ajohnson5/workspace-git-path-dep-test.git@dynamic-version#subdirectory=packages/d

After if I change the branch to static-version in the above toml then the install works completely fine.

Related Issues

#8665

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions