⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Add archives in Git to Direct URL schema#1798

Open
konstin wants to merge 1 commit intopypa:mainfrom
konstin:konsti/archives-in-git
Open

Add archives in Git to Direct URL schema#1798
konstin wants to merge 1 commit intopypa:mainfrom
konstin:konsti/archives-in-git

Conversation

@konstin
Copy link
Contributor

@konstin konstin commented Jan 31, 2025

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 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 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/

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
@webknjaz
Copy link
Member

@konstin try also starting a discussion on dpo — people are sometimes more active over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants