Repository navigation
Conversation
|
@konstin try also starting a discussion on dpo — people are sometimes more active over there. |
rgommers
left a comment
There was a problem hiding this comment.
Thanks @konstin. This accumulated a merge conflict; could you rebase that and re-check it? Then I'll review again.
I did do a quick review pass (using Codex) - it identified that uv merged support recently in astral-sh/uv#10072 - can you check that this PR agrees with that?
Many packaging tools, such as pdm, hatch and uv, extend over PEP 621 allow relative paths in their pyproject.toml ([pdm](https://pdm-project.org/en/latest/reference/pep621/#relative-paths), [hatch](https://hatch.pypa.io/1.3/config/dependency/#local), [uv](https://docs.astral.sh/uv/concepts/projects/dependencies/#path)). This means you can have a dependency on a git repository, and the package in that git repository has a dependency on another package in directory or file in that repository. Currently, `direct_url.json` can only represent subdirectories in a git repository, but not files. This PR tries to fix this asymmetry and make this transitive source representable. It adds a new key `file` to `direct_url.json` that contains the relative path to a source distribution or a wheel. It is mutually exclusive with `subdirectory`, which does the same except pointing to a directory instead of a file. Unlike other entries in `direct_url.json`, this can not be translated back to PEP 518 lacking both archive-in-git and relative path support in PEP 518. It is needed to correctly represent the installation for tools that do support relative paths in dependencies. The name of the key is up for bikeshedding. CC @ofek (hatch), @frostming (pdm), @radoering (poetry) in hopes this is relevant for you too
ca7b7b1 to
f5742eb
Compare
This is still open. It looks like https://github.com/astral-sh/uv/blob/eb03cc21cf3f7e237bcf3e874444a9b0ba5bf04b/crates/uv-pypi-types/src/direct_url.rs#L51 This is a spec addition right, so is the idea you'd change the |
Many packaging tools, such as pdm, hatch and uv, extend over PEP 621 allow relative paths in their pyproject.toml (pdm, hatch, uv). This means you can have a dependency on a git repository, and the package in that git repository has a dependency on another package in directory or file in that repository.
Currently,
direct_url.jsoncan only represent subdirectories in a git repository, but not files. This PR tries to fix this asymmetry and make this transitive source representable. It adds a new keyfiletodirect_url.jsonthat contains the relative path to a source distribution or a wheel. It is mutually exclusive withsubdirectory, which does the same except pointing to a directory instead of a file.Unlike other entries in
direct_url.json, this can not be translated back to PEP 518 lacking both archive-in-git and relative path support in PEP 508. It is needed to correctly represent the installation for tools that do support relative paths in dependencies.The name of the key is up for bikeshedding (as is other terminology that we want to align to existing usage).
CC @ofek (hatch), @frostming (pdm), @radoering (poetry) in hopes this is relevant for you too
📚 Documentation preview 📚: https://python-packaging-user-guide--1798.org.readthedocs.build/en/1798/