How do I download the Python universal wheel for Python 2 and 3?

I have a package on PyPi, and when preparing a new version, I create a source distribution, create a wheel, and download everything with setuptools.

However, I found that it only uploads the wheel for the Python version used in the upload ( python

and python3

) command .

Here are the steps I am taking:

python3 setup.py sdist
python3 setup.py bdist_wheel --universal
python3 setup.py sdist bdist_wheel upload

      

According to the Python Packaging User Guide :

"Universal wheels" are wheels that are pure python (ie, do not contain compiled extensions) and support Python 2 and 3

So that's right for me.

After the wheel build step, I'm sure the wheel is built and has the file format PACKAGE-VERSION-py2.py3-none-any.whl

in dist

, but when I run the download with python3 setup.py sdist bdist_wheel upload

it it builds PACKAGE-VERSION-py3-none-any.whl

and loads that.

If I run python setup.py sdist bdist_wheel upload

it does the same and only downloads Python 2.

+3


source to share


1 answer


The team python3 setup.py sdist bdist_wheel upload

creates a new wheel allocation.

You will need to enable the same flags on this command line:

python3 setup.py sdist bdist_wheel --universal upload

      



Best used twine

to manage downloads; it will use an encrypted connection ( setuptools

uses an unencrypted connection and thus sends your username and password in clarity) and it allows you to validate and test the distribution before downloading:

python3 setup.py sdist
python3 setup.py bdist_wheel --universal
# test the distributions
twine upload dist/*

      

It is currently also the only tool that sets PyPI version metadata correctly for universal wheels .

+13


source







All Articles