Add archives in Git to Direct URL schema #1798
Open
+13
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.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 keyfile
todirect_url.json
that 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/