[Distutils] Replacing pkg_resources with distlib in pip

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Apr 23 01:38:59 CEST 2013


I've made progress in my experiment to replace pkg_resources usage in pip
with code in distlib. The basic approach is to replace references to
pkg_resources with references to pip.vendor.distlib.pkg_resources, where the
latter module is a shim to emulate the pkg_resources API using distlib to
actually implement the functionality.

Although I don't have the very latest upstream pip updates merged in yet, I
have test results which mirror the develop branch (one failure, related to my
test environment - test_correct_pip_version). I believe I have now replaced
all uses of pkg_resources (when I mentioned this effort previously on this
list, pip/req.py had not yet been converted).

Note that the pip.vendor.distlib version is slightly different to the
released distlib - the main difference being that the metadata version in the
released distlib is treated as 2.0, whereas for pip I had to change it to
1.3.

The code is at [1] - the use-distlib branch - and a comparison view is at
[2].

I would appreciate comments, especially from the pip maintainers.

Regards,

Vinay Sajip

[1] https://github.com/vsajip/pip
[2] https://github.com/vsajip/pip/compare/use-distlib




More information about the Distutils-SIG mailing list