Update pip compatibility guide to note transitive URL dependency support (#8081)

## Summary

Closes https://github.com/astral-sh/uv/issues/8080.
This commit is contained in:
Charlie Marsh 2024-10-10 12:21:05 +02:00 committed by GitHub
parent 8f62fc920e
commit f2741220e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 12 deletions

View File

@ -174,22 +174,25 @@ uv pip install wheel && uv pip install --no-build-isolation biopython==1.77
For a list of packages that are known to fail under PEP 517 build isolation, see For a list of packages that are known to fail under PEP 517 build isolation, see
[#2252](https://github.com/astral-sh/uv/issues/2252). [#2252](https://github.com/astral-sh/uv/issues/2252).
## Transitive direct URL dependencies for constraints and overrides ## Transitive URL dependencies
While uv does support URL dependencies (e.g., `black @ https://...`), it does not support While uv includes first-class support for URL dependencies (e.g., `ruff @ https://...`), it differs
_transitive_ (i.e., "nested") direct URL dependencies for constraints and overrides. from pip in its handling of _transitive_ URL dependencies in two ways.
Specifically, if a constraint or override is defined using a direct URL dependency, and the First, uv makes the assumption that non-URL dependencies do not introduce URL dependencies into the
constrained package has a direct URL dependency of its own, uv _may_ reject that transitive direct resolution. In other words, it assumes that dependencies fetched from a registry do not themselves
URL dependency during resolution. depend on URLs. If a non-URL dependency _does_ introduce a URL dependency, uv will reject the URL
dependency during resolution. (Note that PyPI does not allow published packages to depend on URL
dependencies; other registries may be more permissive.)
uv also makes the assumption that non-URL dependencies won't introduce URL dependencies (i.e., that Second, if a constraint (`--constraint`) or override (`--override`) is defined using a direct URL
dependencies fetched from a registry will not themselves have direct URL dependencies). If a non-URL dependency, and the constrained package has a direct URL dependency of its own, uv _may_ reject that
dependency _does_ introduce a URL dependency, uv will reject the URL dependency during resolution. transitive direct URL dependency during resolution, if the URL isn't referenced elsewhere in the set
of input requirements.
If uv rejects a transitive URL dependency in either case, the best course of action is to provide If uv rejects a transitive URL dependency, the best course of action is to provide the URL
the URL dependency as a direct dependency in the `requirements.in` file, rather than as a dependency as a direct dependency in the relevant `pyproject.toml` or `requirement.in` file, as the
constraint, override, or transitive dependency. above constraints do not apply to direct dependencies.
## Virtual environments by default ## Virtual environments by default