question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Declaring extras in constraints file installs also extra dependencies even if not instructed to

See original GitHub issue

Environment

  • pip version: 19.1.1
  • Python version: 3.7.2
  • OS: KDE Neon

Description

In constraints file, when declaring a package with extras, all the dependencies of it get installed, even if actual requirement does not declare extras.

How to Reproduce

echo "requests[security]==2.20.1" > constraints.txt
pip install -c constraints.txt requests

Output

This installs not only direct requests dependencies:

Installing collected packages: chardet, certifi, idna, urllib3, requests

But also [security] extras:

Installing collected packages: idna, chardet, certifi, urllib3, six, pycparser, cffi, asn1crypto, cryptography, pyOpenSSL, requests

Expected behavior

pip should install only direct dependencies, even if extras are declared in constraints file.


This is such a simple case and easy to reproduce, it must be expected behavior. But why? And where is it documented?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pradyunsgcommented, Aug 4, 2020

OK to close, given that we don’t allow this form with the new resolver.

0reactions
uranusjrcommented, Aug 15, 2020

Closing since #8491 is merged and there’s not much else to do here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency constraints for setuptools? - Packaging
I was wondering if it would be possible (and desirable…) to implement something similar for setuptools . What I have in mind is...
Read more >
Installation from PyPI - Apache Airflow
In order to simplify the installation, we have prepared examples of how to upgrade Airflow and providers. Installing Airflow with extras and providers¶....
Read more >
User Guide - pip documentation v22.3.1
Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not.
Read more >
Announcing Poetry 1.2.0 | Blog
As Poetry 1.1 will remove optional dependencies that are not requested, and as it considers setuptools, pip, and wheel to always be optional, ......
Read more >
python - requirements.txt vs setup.py - Stack Overflow
This is a python script which uses the setuptools module to define a python package (name, files included, package metadata, and installation). It...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found