-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
PEP 517 integration #2
Comments
I've tried implementing PEP 517 and also written a bit about that in the blog post, but it failed because pip hasn't implemented that interface yet. The current status is that you can build source distributions with disabled sdist feature, but can't install them. Writing and testing the PEP 517 interface is also blocked on pip, especially since I expect the implementation to differ from the PEP. |
Yes I stumbled on your blog post after opening the issue 😉 Setuptools already has an implementation although I'm not sure if it's really used anywhere. |
pip 19.0 supports PEP 517 now: https://pip.pypa.io/en/stable/news/. |
@konstin do you have any thoughts on how this should go? I see the pyo3-pack wheel just distributes a script right now, and this would need a library as well. |
In the first step, we need to build an sdist. I had some support for this but dropped it. You can see the (likely reusable parts) at 96b0187#diff-3e8b6c785f497d88e8869ef9110c91ea and 96b0187#diff-b507bbbbb0351464abee9a55d2f759ed (and 96b0187 in general). For the bindings actually implementing pep 517 we have afaik three options:
cffi seems to be the worst option, but I don't have preference for pyo3 or subprocess. For subprocess, we can either add the script to the pyo3-pack package or make a miniature standalone package that depends on pyo3-pack. For the pyo3 version I think the best is to add an additional crate to this repo. For all three solutions, we need to check what pip does when an exception is raised in one of the hooks. We also need to make check in pyo3-pack that cargo is installed and print an explanation otherwise (this can actually be done independent of pep 517). |
I've implemented the wheel part of PEP 517 in 671fcdb, which also contains an untested sdist writer. The implementation uses the subprocess-solution. I've filed tox-dev/tox#1344 for isolated builds with tox. |
I've finished sdist support in 78c516f and published a beta version with the (as far as I tested) complete PEP 517 support. Testing and experience reports with the new beta are welcome! The usage is documented in the readme, even though you need to specify |
Hi @konstin! PyOxidezer doesn't support wheels, so it was a good time try out sdist. I've created a
and tried to It seems to be this line: Which blows up because of the emojis in the output (windows doesn't like emojis yet). WDYT? |
Thank you for testing @omerbenamram! Seems I've got bitten by windows default encoding not being utf8 once again. That should be fixed in e7a6a09, and I've published 0.7.0-beta.2 with the fix. |
I see building the |
I notice that if
I need to first create it via |
@ijl Could you explain how you got a Re the second issue: Good catch, I'll fix that. |
@konstin |
|
Thanks for fixing that. Oh, and I mean there was a |
Oh, I see now. I've add a check in dd712c7. Thanks for reporting that! |
@konstin It's now a |
@omerbenamram I've tried another workaround for the encoding errors in #153, which makes it pass on machine (German / cp1252). It still prints a warning however about the output not being cp1252 and print surrogates instead of emoji, even though the terminal supports utf8.
@ijl Could you explain the use case for only building an sdist? |
@konstin I want to have a test in which I build an sdist and install it via pip. Building the project twice would be unnecessarily slow. |
I see this as working well. I think it would be prudent to make the documented usage build a non-manylinux release wheel with pinned versions:
|
@konstin it works! sweet :) |
Is there a reason not to use tox with build isolation, which builds an sdist before building a wheel, or
I've changed the implementation to always use release mode and opened a thread on the python discourse on the topic. I've also exposed the strip option. Having |
I have it right now as |
I've created pypa/pip#6669 for solving this properly in pip. |
beta.5 works perfectly for my use case, including |
Thank you all for the beta testing and the feedback! The only thing missing is the tox integration, which fails due to a bug in tox; I've opened #176 to track that. For everything else that comes up, please open a new issue. |
The recent PEP 517 specifies an interface for alternative build systems to be defined, which is exactly what's happening here.
To do that,
pyo3-pack
would need to provide a very simple Python interface with the following hooks:build_wheel
to build a wheelbuild_sdist
to build a gztarred archive of the source code(actual semantics are defined in the PEP).
Then, releasing the
pyo3-pack
module to PyPI would allow users to specify the build system inpyproject.toml
, making it easier to build a Rust wheel withoutsetuptools
.The text was updated successfully, but these errors were encountered: