Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and publish pure python wheel #260

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

wilhelmklopp
Copy link
Contributor

👋 I'm using mocket from inside pyodide and pyodide requires "pure python wheels" to be able to install a given package.

I saw that mocket currently publishes only an sdist and not a pure python wheel, so making this PR to add a pure python wheel as well.

I tested out the change and it seems to work:

@wilhelmklopp ➜ /workspaces/python-mocket (build-pure-python-wheel) $ uv run python3 -m build --sdist --wheel .
* Creating isolated environment: virtualenv+pip...
* Installing packages in isolated environment:
  - hatchling>=1.22.2
* Getting build dependencies for sdist...
* Building sdist...
* Creating isolated environment: virtualenv+pip...
* Installing packages in isolated environment:
  - hatchling>=1.22.2
* Getting build dependencies for wheel...
* Building wheel...
Successfully built mocket-3.13.2.tar.gz and mocket-3.13.2-py3-none-any.whl
@wilhelmklopp ➜ /workspaces/python-mocket (build-pure-python-wheel) $ ls -lh dist/
total 96K
-rw-r--r-- 1 codespace codespace 22K Nov  2 17:56 mocket-3.13.2-py3-none-any.whl
-rw-r--r-- 1 codespace codespace 72K Nov  2 17:56 mocket-3.13.2.tar.gz

To be honest, before running into this issue I didn't know much about pure python wheels, but it seems like they've been around for a number of years and their use is encouraged. More docs.

I asked Claude to see if there are any downsides to publishing a pure python wheel alongside an sdist and it couldn't come up with anything beyond "now two files need to be uploaded to PyPI". It's encouraging to see that the pure python wheel is also smaller in size (22K vs 72K) meaning all mocket users should benefit from this change with less data traveling over the network and faster install time.

Copy link

sonarqubecloud bot commented Nov 2, 2024

@mindflayer mindflayer merged commit 6430837 into mindflayer:main Nov 3, 2024
1 check passed
@mindflayer
Copy link
Owner

It's encouraging to see that the pure python wheel is also smaller in size (22K vs 72K)

Since in the end they are both compressed archives, I believe that the ony reason why the wheel is smaller is that it does not contain all the tests, that I've been requested to include in Mocket releases.
It's fine though, because tests are already available as part of the sdist package, so we'll have a lighter one for people installing from wheels, and a more complete package for who's interested in also running tests (Linux distro package maintainers normally are).

This said, I've just released the wheel for the latest version of Mocket, and I am going to merge this small change. Thanks!

@mindflayer
Copy link
Owner

Btw, you were lucky because only recently I removed the remaining binary dependency from Mocket! :D

@coveralls
Copy link

Coverage Status

coverage: 99.531%. remained the same
when pulling 7fa2eeb on wilhelmklopp:build-pure-python-wheel
into 8a4cc72 on mindflayer:main.

@wilhelmklopp wilhelmklopp deleted the build-pure-python-wheel branch November 3, 2024 14:14
@wilhelmklopp
Copy link
Contributor Author

You're the best Giorgio, thanks! Really appreciate the quick reply + wheel publish ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants