Menu

#2 Using custom index url

resolved
nobody
None
minor
bug
2020-03-30
2020-03-25
Phil Elson
No

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.

Discussion

  • Phil Elson

    Phil Elson - 2020-03-25

    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/

     
  • Anthon van der Neut

    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:

    pip search pip | grep -E '^pip ('
    

    to retrieve the version number and when appropriate

    pip download --dest /your/pythons/wheel/dir --only-binary=:all: pip
    

    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
  • Anthon van der Neut

    • status: open --> resolved
     
  • Phil Elson

    Phil Elson - 2020-03-30

    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:

    $ ls -ltr ./lib/python3.6/ensurepip/_bundled/
    pip-18.1-py2.py3-none-any.whl           pip-20.0.2-py2.py3-none-any.whl         setuptools-40.6.2-py2.py3-none-any.whl  setuptools-46.1.3-py3-none-any.whl
    

    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
  • Anthon van der Neut

    • status: resolved --> open
     
  • Anthon van der Neut

    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

     
  • Anthon van der Neut

    • status: open --> resolved
     
  • Anthon van der Neut

    I tested 0.2.1 on Python 3.6.10 using:

    /opt/python/3.6.10/bin/pip install upgrade_ensurepip
    /opt/python/3.6.10/bin/python -m upgrade_ensurepip --pip
    /opt/python/3.6.10/bin/python -m venv /opt/util/test5
    

    so I think this is solved

     

Log in to post a comment.