Upload wheels to PyPI rather than eggs
Brought to you by:
dkuhlman
Wheels are current best practice for distributing Python packages: https://packaging.python.org/discussions/wheel-vs-egg/
Wheels (.whl) for this package are currently missing from PyPI. Could wheels be uploaded for the current and future releases?
Read more about the advantages of wheels to understand why generating wheel distributions are important.
To create a wheel along with source distribution:
(venv) $ pip install --upgrade pip setuptools wheel
(venv) $ python setup.py sdist bdist_wheel
# See dist/*.whl
To upload wheels:
(venv) $ pip install twine
(venv) $ twine upload dist/*
I would recommend the publishing procedures for this project be updated to upload wheels in place of eggs. Eggs should no longer be needed these days (I have not seen an active project publish them in many years).
John,
Thank you for this suggestion and your guidance.
OK. I've added it to my build script and have built a
*.whlfile. I have not yet uploaded it to PyPI.Am I supposed to upload both the wheel and the egg files? Or, are egg files no longer in use? Is there any downside to uploading both wheel and egg files o PyPI?
I'm curious -- Given the way we currently have it (an egg but not a wheel at PyPI), does PyPI automatically convert the egg to a wheel when I install
generatedsusingpip?Thanks in advance for help.
The eggs are not needed and aren't used any more as far as I can tell. I would simply avoid uploading them any longer.
From the test below, this is working as I had expected. The egg is ignored and the sdist (.tar.gz) is being downloaded for every client and a wheel is built after the fact.
When a wheel is uploaded,
pipwill simply download and install it directly, avoiding the need for each user to run the build step.Last edit: John Hagen 2021-04-15
Thanks for advice.
I've uploaded the wheel for the latest version (v. 2.38.6). I won't try to delete any egg files at PyPI (don't know if that can be done).
But I've remove the egg file from the script that I use to do the upload to PyPI (
generateds/upload_pypi). So, the egg will not be at PyPI for future versions. If someone complains, I can always put it back.Thanks again for the suggestion. And, please let me know whether the wheel (from PyPI) does what you expect it to.
Everything looks great now: