aboutcode-org / python-inspector

Inspect Python code and PyPI package manifests. Resolve Python dependencies.
22 stars 19 forks source link

Issue 180: Fix not parsing pip.conf index urls #181

Open calizarr opened 3 months ago

calizarr commented 3 months ago

Fixes: https://github.com/nexB/python-inspector/issues/180

pip prefers the usage of the CLI tool to get information, therefore I resorted to subprocess for this. This should get the information from the pip CLI tool and then add it into the index_urls tuple.

Thanks.

calizarr commented 3 months ago

I cannot get a good grasp on why the tests are failing. The diffs are a bit too long and the only change should be in the index_urls. If empty, then it should be equivalent to the same as before. If not, then yes things would change, but searching for the specific part in the diff is almost impossible.

calizarr commented 3 months ago

After running:

./configure --clean
./configure --dev
PYINSP_REGEN_TEST_FIXTURES=yes ./venv/bin/python -m pytest -vvs --color=yes

Then there are some pycodestyle failures in my recently added code, however, there are still other failures that have to do with package versions not being exact. I can change those etc. although it's certainly not what this PR is meant to do.

sschuberth commented 3 months ago

Note that @heliocastro already filed https://github.com/nexB/python-inspector/pull/170, which seems to be related.

calizarr commented 3 months ago

Note that @heliocastro already filed #170, which seems to be related.

They are incredibly related if not almost identical. However, pip warns against using it as a library

As noted previously, pip is a command line program. While it is implemented in Python, and so is available from your Python code via import pip, you must not use pip’s internal APIs in this way.