Pip doesn’t allow you to self-depend
See original GitHub issueDescription
When specifying dependencies, you sometimes want to depend on other extras:
[project]
name = 'my_pkg'
[project.optional-dependencies]
test-utils = ['pytest', 'requests-mock', '...']
test = ['my_pkg[test-utils]']
Expected behavior
@uranusjr said it should work:
Circular dependency is a feature that Python packaging is explicitly designed to allow, so it works and should continue to work. […]
pip version
21.2.4
Python version
3.9.6
OS
Arch Linux
How to Reproduce
- Create a new package with something like the above setup
- Install it with the extra depending on itself:
pip install .[test]
- It can’t find the package because it doesn’t merge
.
withmy_pkg
Specifying test = ['.[test-utils]']
doesn’t work.
Output
It does not pull the extra from the current package, but rather from the existing cached packages. So if you add a new extra […] and then depend on it, it starts spewing out a long list of package checking:
Collecting my_pkg[test-utils]
Using cached my_pkg-1.11.1-py3-none-any.whl (1.5 MB)
WARNING: my_pkg 1.11.1 does not provide the extra 'test-utils'
Using cached my_pkg-1.11.0-py3-none-any.whl (1.5 MB)
WARNING: my_pkg 1.11.0 does not provide the extra 'test-utils'
Using cached my_pkg-1.10.0-py3-none-any.whl (1.5 MB)
WARNING: my_pkg 1.10.0 does not provide the extra 'test-utils'
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
pip not working in Python Installation in Windows 10
Doesn't work from Windows command line. Adding the path in Windows 10, seems Windows 10 doesn't allow. – user5621062. Oct 4, 2016 at...
Read more >Pyproject.toml optional dependencies redundancy aka DRY ...
Let's consider an imaginary package, called example. ... so I filed one: Pip doesn't allow you to self-depend · Issue #10393 · pypa/pip...
Read more >Using Python's pip to Manage Your Projects' Dependencies
The standard package manager for Python is pip . It allows you to install and manage packages that aren't part of the Python...
Read more >How to Install Pip on Windows - ActiveState
Pip is the standard package manager for Python. It enables the installation and management of third party packages that provide features and ...
Read more >User Guide - pip documentation v22.3.1
When you install pip, a pip command is added to your system, ... used to force pip to properly resolve dependencies. pip 20.2...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, results:
20.3 was when the default resolver switch, so that behavioural change makes sense. I can’t quite point out what exactly changed in 21.2 that makes this work (that release contains quite several resolver tweaks), but glad to hear its working now. I think this would be a very big step toward more declarative metadata definition since we no longer need to either write custom tooling to preprocess metadata, or manually constructing extras in
setup.py
to avoid duplication.