Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use relative paths in pyproject.toml for path dependencies #6684

Description

@harrymconner

My company organizes its python code in a monorepo, and the recent addition of relative paths in lockfiles (#6490) convinced me to switch to uv! I was wondering if it would also be possible to use relative paths in the pyproject.toml file when uv add-ing path dependencies? Here is the repo structure for reference:

root
├-libs
│  ├-liba
│  └-libb
└-projects
   └-projecta

I want to add libb as a dependency to projecta, so I run the following command: uv add ..\..\libs\libb --editable from projecta. This gives me the following [tool.uv.sources] section in projecta's pyproject.toml:

[tool.uv.sources]
libb = { path = 'C:\full\path\to\the\library\libb', editable = true }

Since all of my team members have the monorepo checked out to different locations on their machine, I would like to have the dependency added as a relative path for consistency:

[tool.uv.sources]
libb = { path = '..\..\libs\libb', editable = true }

Please let me know if you have any questions on this use case!

Relevant info:

  • Platform: Windows 11
  • version: uv 0.3.4 (39f3cd2 2024-08-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliRelated to the command line interface

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions