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.

Restrict unused version pins in URL/VCS requirements?

See original GitHub issue

What’s the problem this feature will solve?

I noticed this behavior while debugging/repro-ing https://github.com/pypa/pip-audit/issues/382: pip install -r requirements.txt will happily install a VCS or other URL dependency that contains a fragment string like this:

hypothesis @ git+https://github.com/HypothesisWorks/hypothesis.git@bb6b55ad8d#egg=hypothesis==9.9.9&subdirectory=hypothesis-python

The egg=hypothesis==9.9.9 fragment implies that hypothesis==9.9.9 is being installed from this URL, but that version specifier is actually ignored and the real version at that VCS ref (6.56.3) is installed instead.

AFAICT this version pin was never supported in the first place (https://github.com/pypa/pip/issues/5384 says that the egg fragment has never supported 508-style specs), but it’s a little surprising (as an end user) for it to silently be ignored rather than producing a warning or requirements parsing error.

Describe the solution you’d like

Ideally, pip would produce a hard error (or at least a warning) here, since the supplied version specifier is (1) ineffective and (2) indicates user confusion about what they’re asking for.

Alternative Solutions

No alternative solution is necessary, since this isn’t broken per se.

Additional context

pip-audit context: https://github.com/pypa/pip-audit/issues/382

This issue also manifests in third-party requirements-file parsers, like pip-audit and pip-requirements-parser. If this behavior is changed in pip itself, I can submit patches there as well.

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
pfmoorecommented, Oct 31, 2022

+1 on giving an error for anything other than #egg=name where name follows the specification for a project name.

0reactions
uranusjrcommented, Nov 23, 2022

If I remember the history correctly, originally #egg was meant to be just the project name (designed by setuptools), which pip copied. It was later extended to be able to take extras (otherwise there’s no way to specify extras for a URL) and pip’s documentation was probably never rewritten to reflect the fact. And then PEP 508 came out and should have made everything irrelavant, but people still continue using #egg to this day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >
Release and Version History — pipenv 2022.12.20.dev0 ...
Pipenv will now ignore .venv in the project when ; Fix an edge case of hash collection in index restricted packages whereby the...
Read more >
pip - bytemeta
"pip is looking at multiple versions of {package_name}" INFOs obscure actual error. deeTEEcee ... Restrict unused version pins in URL/VCS requirements?
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