Not looking at pip.conf when doing the upgrade check?
jhermann opened this issue · 20 comments
Given my first tests, you don't support ~/.pip/pip.conf
when doing the version checks, specifically its index-url
setting – that in turn prevents the use of local PyPI caches (e.g. devpi).
Indeed, I don't check nor support local caches at the moment.
The package checks pypi rest api for available upgrades.
This requires quite some implementation, if I will have some time to implement it, I'll let you know.
Meanwhile, merge requests are welcome. Just announce if you start working on some feature so we don't both work on the same functionality.
Thanks 😉
What I target is taht you change the PyPI URL from the default to some other URL – same API, just another end-point. Needs reading the INI file, and overriding the default URL when set.
I see.
Can you paste the contents of the file, so i can know how to parse it? Also, any other possible alternative paths for that ini file.
I will fix it today if you send me the required info.
$ pip install -h | grep .-i,.--index-url
-i, --index-url <url> Base URL of Python Package Index (default http://localhost:3141/local/dev/+simple/). This should point
The possibly best way to handle this is to import pip
and then to follow the code path the "help" code uses to display that default – then this is always compatible to what pip does.
Yeah, I'm following the code path to read configs.
The way they parse values is very strange.
Instead, there is this list: pip.locations.site_config_files
.
on MacOs:
In [13]: pip.locations.site_config_files
Out[13]: ['/Library/Application Support/pip/pip.conf']
on Linux:
In [2]: pip.locations.site_config_files
Out[2]: ['/etc/xdg/pip/pip.conf', '/etc/pip.conf']
It does not seem to search in homedir.
I'll create a predefined list of config locations based on their docs, and add the ones imported from pip. And parse them using ConfigParser.
Please paste here your index-url=
setting and also the full json path for a package.
Ex: https://pypi.python.org/pypi/requests/json
The implementation is almost done, just checking that index-url parsing is done correctly.
Can you test master branch for index-url detection?
Clone and pip install -e .
I released new version on pip. I hope the URL you have in config is parsed.
Testing against Artifactory…
- You need to map package names →
from packaging.utils import canonicalize_name
- You mangle the below URL to
/artifactory/api/pypi/{package}/json
, that's not correct:
[global]
index-url = https://repo.local/artifactory/api/pypi/local/simple
- Artifactory does not support /json, i.e. would be nice if you (also) supported the old 'plain HTML listing' way.
I'll try devpi
during the weekend…
@jhermann I'll check canonicalize_name.
This would be a correct example of plain html package page?
https://pypi.python.org/simple/django/
If so, parsing it should be quite simple.
@jhermann If the index-url ends with /simple
, (ex: https://repo.local/artifactory/api/pypi/local/simple
the html url for a package would be https://repo.local/artifactory/api/pypi/local/simple/django
(and django
canonicalized. Is this correct?
Yes, what you get is a HTML page consisting mostly of "a href" references to the different package types (whl, zip, …) and versions. Supporting that original "simple" scheme depends on parsing the file names, and might be fragile (check the pip code on how many edge cases there actually are). Maybe "packaging" has some support code for that.
Another option is to add "…/json" to Artifactory, do you happen to have a PEP link or something similar for that?
Regarding devpi support, this is a simple index example: https://devpi.net/hpk/dev/+simple/tox
Not sure if it supports the JSON API (example: tox). @hpk42 ?
Done in 259346f, you can test it with pip install pip-upgrader==1.4.dev1
.
The simple html parsing is quite generic, and it will be applied to index-url
which ends with .../simple
or .../+simple
.
Works with devpi, trying with Artifactory tomorrow.
Cool 😉
As expected, Artifactory works too.
One minor addition left: please look at the PIP_INDEX_URL env var before checking the config, if that's non-empty, use it. Besides other issues, that makes testing a lot easier.
Implemented support for PIP_INDEX_URL environment varibale, and release 1.4.0
. Have fun 😉