Currently the index-url is hard-coded into upgrade_ensurepip.
It would be great if we could configure a custom index-url (in exactly the same way we can with pip) such that upgrade_ensurepip can be used with custom indexes and behind firewalls which prevent external internet access.
Incidentally, it would also be great to make use of the simple index definition, rather than the json based pypi index definition. The former is refered to as the "legacy" interface: https://warehouse.readthedocs.io/api-reference/legacy/, but appears to be better covered by PEPs than the new JSON one. There is a client that you could benefit from at: https://pypi.org/project/pypi-simple/
Thanks for the report, I looked at this, but decided not to go with the legacy interface (and a possible dependency on pypi-simple).
Instead I added a
--pip
option that switches from using the JSON info to essentially doing:to retrieve the version number and when appropriate
to download.
I hope that gives enough flexibility to the packages and their info from a local (devpi?) repository.
If it indeed does, please close this issue.
Last edit: Anthon van der Neut 2020-03-29
Thanks for the update! I had two issues:
To run update_enurepip neither the entry-point update_enurepip, nor the main from python -m update_ensurepip get access to the --pip argument you put on the
if __name__ == __main__
block of upgrade_ensurepip/upgrade_ensurepip.py. I recomment a built-in tool like argparse for this, and exposing the arguments to both the main and the entrypoint.In addition I had the following issue after having upgraded and running python -m ensurepip:
FileNotFoundError: [Errno 2] No such file or directory: './lib/python3.6/ensurepip/_bundled/setuptools-46.1.3-py2.py3-none-any.whl'
Upon inspection:
We can see that pip will happily download a wheel that has no such py2 tag. I believe upgrade_ensurepip is going to have to handle the lack of a py2 tag soon at some point if you wish to be able to get the latest setuptools.
Last edit: Phil Elson 2020-03-30
Thanks for pointing out the problem with checking for
--pip
before calling main. I'll fix that but I am not going to import argparse until I have more options/arguments to process than this one.Until https://bugs.python.org/issue40119 is fixed I'll need to rename the downloaded setuptools wheel
I tested 0.2.1 on Python 3.6.10 using:
so I think this is solved