pip-download icon indicating copy to clipboard operation
pip-download copied to clipboard

Conflict between platform and version check

Open g3n35i5 opened this issue 4 years ago • 3 comments

When i'm using pip download the following way

pip-download --python-version py3 --python-version cp37 --platform-tag manylinux1_x86_64 --dest . --no-source beautifulsoup4==4.8.2

i will get the following downloads

beautifulsoup4-4.8.2-py2-none-any.whl
beautifulsoup4-4.8.2-py3-none-any.whl
soupsieve-2.0.1-py3-none-any.whl

Although I only search for packages containing cp37 or py3 in the name, the package beautifulsoup4-4.8.2-py2-none-any.whl is still downloaded.

I suspect that this is because the platform is checked first and then the version:

if "none-any" in file:
    download(file, dest_dir)
    continue

# ...

if python_versions:
    for version in python_versions:
        if version in file:
            eligible = True
            break
        else:
            eligible = False

g3n35i5 avatar Sep 03 '20 07:09 g3n35i5

I am not sure if this is suitable. Packages include "none-any" should be downloaded no matter which version of Python is. The option --python-version is used to specify a more detailed version number, not Py2 or Py3. More is better than less, although one more package is downloaded. Anyway,is there a better idea?

youngquan avatar Oct 04 '20 04:10 youngquan

@youngquan You're right, according to PEP 427, the "none-any" part of the filename says the following:

  • none (ABI tag): Should work with all ABI's
  • any (platform tag): Should work with all platforms.

However, there's a difference between the python version tag (e.g. py3) and the ABI tag (e.g. cp37): Some packages only work with the CPython interface and are therefore limited in the usable python version. A package "xy.py3-none-any.whl" works with all python3 versions, a package "xy.py3-cp37-any.whl" only works with python3.7.

TLDR: I think for the beginning, #18 should do the job (thanks @stalkerbear :+1: )

g3n35i5 avatar Oct 05 '20 06:10 g3n35i5

@youngquan Are there any concerns or comments on your part?

g3n35i5 avatar Oct 19 '20 07:10 g3n35i5