12

I know that wheels are binary version of a module uploaded on PyPI.

with pip install

  • On Windows: I get wheels downloaded and installed.
  • On Ubuntu: I should get the source distribution of the package BUT in some cases I get wheels.
  • On fedora: Tricky I have to install with dnf

I tried to add wheels to my package as well. But I am only able to upload wheels for windows.

  • Why do some packages provide wheels for Linux platform?
  • Is this okay? Providing binaries instead of the source?
  • Why I cannot provide wheels?

Note: I know a bit about Fedora rpm packages. I am interested now in wheels on Ubuntu.

selurvedu
  • 501
  • 1
  • 8
  • 21
Szabolcs Dombi
  • 5,493
  • 3
  • 39
  • 71

1 Answers1

10

Why do some packages provide wheels for Linux platform?

Why shouldn't they, as long as source distributions are available as well? :)

Your question is not clear. If you meant

Why do some packages provide platform-specific wheels for Linux platform instead of platfom-independent ones?

then take a look at this question and its answers. If not, please clarify your question.


On Ubuntu: I should get the source distribution of the package BUT in some cases I get wheels.

Try using:

pip install --no-binary :all: somepackage

This should make pip download a source distribution if it exists on PyPI. I don't know why there are no source packages for PyQt5 on PyPI, probably because they are not installable with pip and need a whole toolchaing for compilation.


Is this okay? Providing binaries instead of the source?

It's okay as long as you provide both binaries and the source. I suggest you doing so.


Why I cannot provide wheels?

Try python setup.py bdist_wheel. You need to install wheel package (on PyPI) to make it work. If your package supports both Python 2 and 3 and contains no C extensions, append the --universal option to make a "universal wheel".

Replace bdist_wheel with sdist to make a source distribution. It will create an archive in dist directory.

sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.

You can specify as many formats as you like using the --formats option, for example:

python setup.py sdist --formats=gztar,zip

to create a gzipped tarball and a zip file

(Quote from https://docs.python.org/3/distutils/sourcedist.html)


More info about packaging and wheels is available here: https://packaging.python.org/distributing/#packaging-your-project

Community
  • 1
  • 1
selurvedu
  • 501
  • 1
  • 8
  • 21
  • When I try to upload wheels on Linux I get an error, I will paste it here as soon as I can. (today) – Szabolcs Dombi Jul 21 '16 at 08:54
  • 2
    https://packaging.python.org/current/#id8 "PyPI currently only allows uploading Windows and Mac OS X wheels, and they should be compatible with the binary installers provided for download from python.org. Enhancements will have to be made to the wheel compatibility tagging scheme before linux wheels will be allowed." – Eyal Levin May 21 '17 at 11:07