vendoring logic subtly breaks later usage of unvendored system versions after importing pkg_resources.extern
See original GitHub issueIn theory, if pkg_resources.extern is devendored, it should defer to the system installation of e.g. packaging, which means that:
>>> packaging.version
<module 'pip._vendor.packaging.version' from '/usr/lib/python3.6/site-packages/packaging/version.py'>
>>> pkg_resources.extern.packaging.version
<module 'pip._vendor.packaging.version' from '/usr/lib/python3.6/site-packages/packaging/version.py'>
It would be expected that I could then compare the results, since they’re the same thing.
>>> pkg_resources.extern.packaging.version.parse('3.0') == packaging.version.parse('2.0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'Version' and 'Version'
Oops?
For comparison, this works fine when using the similarly devendored pip.
>>> pip._vendor.packaging.version
<module 'packaging.version' from '/usr/lib/python3.6/site-packages/packaging/version.py'>
>>> packaging.version
<module 'packaging.version' from '/usr/lib/python3.6/site-packages/packaging/version.py'>
>>> pip._vendor.packaging.version.parse('3.0') > packaging.version.parse('2.0')
True
Note that pkg_resources must not be devendored from pip, or else it must be deleted from vendor/__init__.py, since otherwise it will be automatically imported. Even importing pkg_resources causes pip to fail as well.
>>> import pip._vendor.packaging.version
>>> import packaging.version
>>> pip._vendor.packaging.version.parse('3.0') > packaging.version.parse('2.0')
True
vs.
>>> import pip._vendor.packaging.version
>>> import pkg_resources.extern
>>> import packaging.version
>>> pip._vendor.packaging.version.parse('3.0') > packaging.version.parse('2.0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'Version' and 'Version'
https://github.com/pypa/pip/issues/5429#issuecomment-391070003 suggested the problem is deleting the global module unconditionally, whenever something vendored is in use. This strikes me as incredibly dangerous.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Pyodide - Read the Docs
runPython( import sys sys.version. ); After importing Pyodide, only packages from the standard library are available. See Loading packages for ...
Read more >vendor directory in Go - Medium
vendor directory in Go. How the hell can we use specific locked versions of libraries, without breaking the entire app? Use $GOPATH they...
Read more >2018 March - Techrights
The release upgrades an unsupported version of SLES SP2 Raspberry Pi image released at 2016 SUSECON, which offered enterprises an alternative to Raspbian...
Read more >[Checkins] SVN: topia.postag/trunk/ This package implements ...
Log message for revision 100547: This package implements text keyword extraction by making use of a simple Parts-Of-Speech (POS) tagging ...
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
If anyone else’s still looking for a “good enough” hack, I’ve ended up taking unbundling one step further and removing
setuptools.extern
andpkg_resources.extern
entirely:Ironically, this bug is now causing 60.6.0 tests to fail: