-
Notifications
You must be signed in to change notification settings - Fork 36
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
Encourage users to upload wheels for pure Python packages #496
Comments
Minor correction on this: ~25% of the top 4000 most frequently download packages (according to this list) don't have a published |
Is that a problem if those package maintainers don't feel that wheels are important or valuable enough to generate? Put another way, I recall people feeling that binary distributions restricted "freedom" and were vocally against introducing the wheel format. Is this less than ideal? Certainly. Is it possible these are ideologues refusing to distribute something they fundamentally disagree with? Yes.
Some people are also set in their ways and want to have that dynamic behaviour which also rules out wheels for them. These two things are not entirely separate.
Unfortunately, the best motivator to do anything will always be "My users find this valuable". The next best will be "this tool I use suggests I do so and links to compelling reasons to do so and/or automates doing so for me". As for "centralized solution", as far as I know,
Twine could then query the index to determine if there's a wheel that exists, but we don't do that today and I'm not convinced we should start. If something were to give this warning, it should be PyPI. And I won't speculate on a possible implementation. In general, this issue probably belongs on |
Thanks for your response @sigmavirus24 !
Yes, if you could move it it would be great. It's related to #25 (but that one focuses more for wheels for packages with C extension). |
I think this is probably a duplicate of #25, which I don't think is exclusive to wheels with C extensions. I think the "Create a generic wheel-building service to make releases faster and more robust" part of https://github.com/psf/fundable-packaging-improvements/blob/master/FUNDABLES.md is also relevant here. |
Build creates both wheel and SDist by default, so that helps here I think. And tools like cibuildwheel helps making binary wheels (ideally) on CI if it's not pure Python. As long as docs point to making and uploading wheels too, which I think ours do, I don't know if there's that much that can change. |
If PyPi could build the wheel automatically for pure Python packages, that would clearly be the ideal case. But I imagine that would take lots of effort and funding...
It's not, but the subset of that issue discussed here, should also be less difficult to address from a technical/UX point of view (since it doesn't need to deal with the building C extensions discussion).
What command do you mean by "build"? Yeah, if the default workflow was twine build # generates sdist + wheel for pure Python packages
twine upload # without specifying the path, upload both (or using some other tool) then most of this issue would be addressed IMO. |
pip install build
python -m build or pipx run build (Which works on GHA out of the box with no Python setup!) See https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives or https://scikit-hep.org/developer/gha_pure for examples. |
https://pypi.org/project/build/ That's the build tool recommended in the tutorial. |
That's great, thanks! I missed that development. Just need support for, twine upload # without a path then... |
To elaborate, I'm not sure this applies to other maintainers, but I would probably not run
as recommended in the tutorial, but rather would upload them one by one separately to make sure no other unrelated packages get uploaded (for instance |
This would be a mess; there are pure Python packages that depend on the Python version to generate a wheel, for example; so it it was done "automatically", then the wheel would only work on one version of Python. Most packages do provide wheels; the ones that don't usually have a reason they are working on it.
Most tools (pip (?), build, gh-action-pypi-publish) assume |
That's because this is being misused, you should use You can do |
Not exactly, it generates wheels for any dependencies that do not have wheels already uploaded for your system. So if numpy doesn't have a wheel for your arch, then it will build NumPy and put the wheel in the wheelhouse. If it's already on PyPI for your system, it will just use PyPI and will not add it to the built wheels in the wheelhouse. The wheelhouse + PyPI (or whatever index you are using) should be enough to install the current package without building anything. |
Thanks for the clarifications!
Yeah, I realize it's a complex subject, I'm clearly not suggesting it in this issue.
Then https://packaging.python.org/guides/distributing-packages-using-setuptools/#wheels needs updating.
It's not about ease of use but about confidence it won't upload any unrelated wheels (or versions) that happen to be in that folder. And also making it harder from a UI perspective not to upload a wheel it if it's already generated by |
Also unless I'm mistaken that page doesn't mention the |
I agree. And there is too much duplication in packaging.python.org, IMO...
|
My understanding is that https://github.com/pypa/pep517/ provides such unified interface. In fact, that's what pip-tools uses now to universally extract requirements from local packages, without the need of choosing which file to parse (have a look at jazzband/pip-tools#1311, as well as this comment pypa/setuptools#1951 (comment)). |
Can someone open an issue in twine with the suggestion for the "smart" default, using |
If |
Issue originally opened at pypa/twine
I was wondering if there is any mechanism that would allow encouraging users to upload wheels for pure Python packages? Unless this should be a feature request for https://github.com/pypa/warehouse?
Problem statement
Currently some package maintainers only upload a .tar.gz to PyPi for pure Python packages, without the associated wheel. For instance, according to the analysis in https://gist.github.com/josephrocca/ca3f09c4db1df6288bbc64428e6bed77 around 1/4 of
1004000 most frequently downloaded PyPi packages only include the source distribution. Some maintainers might forget, other may not be aware of the motivation to do so.This results in,
setup.py
)wheel
package to create.whl
if not available? pyodide/pyodide#1501). We keep asking maintainers to add wheels but approach doesn't scale, and we were wondering if some centralized solution might exist that would benefit everyone, and slowly move the ecosystem in that direction.For instance
poetry publish
would already upload both the.tar.gz
for pure Python packages.Possible implementation
Given that artifacts can be uploaded with multiple calls, I'm not sure if it's something that would be technically possible even in case of interest in this feature.
One possibility could be to display a note/warning, if twine is used to upload the sdist and the corresponding wheel is not present for pure Python packages. Though that would likely produce false positives.
Another possibility could be to emphasize this a bit more in the documentation.
The text was updated successfully, but these errors were encountered: