-
Notifications
You must be signed in to change notification settings - Fork 4
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
Options for distributing without rustc? #2
Comments
Hey @MatthiasKauer, It looks like binary Rust wheels are not easy either (pypa/setuptools#435). |
Great Idea @MatthiasKauer ! Until rust is as mainstream as C compilers, asking your users to compile rust to use your extension is likely to alienate them just a little bit. So as @kmike suggests you would really want to distribute binary wheels. I don't see why in principle wheels can't be made to work, but I haven't tried. If you work out how to hook distutils, I'd love to incorporate it into this project as long as it's clean. You should be aware that working out how to use rust-cpython is very daunting and it only runs on rust nightlies. While I am optimistic about its future given the obvious benefits of the approach, I don't believe it's really ready for writing production libraries just yet, which is why I haven't done much more in this space lately. (maybe I should revise the promises I give in the README.md?) |
Hi, I was more worried about this PEP: https://www.python.org/dev/peps/pep-0491/ |
@MatthiasKauer yeah, almost: wheels work on Linux, but you can't safely share them and distribute them if machines are different. There is https://www.python.org/dev/peps/pep-0513/ in works to overcome it. |
exactly, that's the one we would need @kmike And regarding rust-cpython: I was under the impression that its goal is the other direction, i.e., calling Python from Rust. Am I mistaken there too? |
You would need also equivalent guarantees from the rust packager. I don't know if that's on the table for rust. On the up side maybe linux users are more amenable to installing rustc especially if there is an appropriate version in their package manager. rust-cpython is just a wrapper around the Python C API, meaning it is suitable wherever the Python C API is - either embedding Python in an application, or calling C libraries from python. It does contain examples of how to do either. My personal interest is in the latter. |
Hi, author of bdist_wheel here. I've been working on a different way to make wheels using SCons that I hope will be useful. IMO it is simpler and easier to understand than bdist_wheel because it does not use the setuptools/distutils architecture at all, but it also emulates setup.py to create pip-compatible sdists. Here's an example build file for Simon's cffi Rust example. https://github.com/dholth/hello-pyrust/blob/master/SConstruct I'd be interested in hearing whether this is useful to you. |
cool. I guess the equivalent of rust-python-ext for your new system would be a Builder for rust libs? How is scons going with python 3 support? |
Yes. As you can see on line 28 invoking cargo with an env.Command() is really easy too, it is not like GCC where you have to understand a ton of options and a multi-step compile - link toolchain. Or you could publish a pypi project that adds a rust builder and install it before setup on line 3 of this file https://github.com/dholth/hello-pyrust/blob/master/pyproject.toml SCons works on Python 3 for everything I've tried to do with it. enscons automatically pulls in the correct SCons from https://pypi.python.org/pypi/import-scons |
oh, neat. with some sort of trunk scons? pip3 install scons for me tries to install 2.5.0 and errors because it explicitly doesn't support py3 |
https://github.com/timj/scons/tree/u/timj/python3
|
@dholth Just to clarify: Your scons solution does indeed build a binary wheel such that the end user doesn't need a rust compiler anymore? That would be a great step. |
That's right. It builds wheels and gives you lower level control over how the wheel is built compared to setuptools. After the wheel is built it's no different and you can distribute the wheels normally. —You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. |
Hi,
I'm interested in your project because I'm looking for an alternative to C++ extensions. I'm now wondering how the odds are for distributing an extension that I would write.
In C++, I could build a wheel for Windows and Mac and then expect that Linux users would have a compiler ready.
With Rust, however, this may not work that way.
The wheel building part for Win/Mac may still work out (will it?)
I'm most worried about the Linux part since rustc will just not be available everywhere for the foreseeable future. How well does Lbinary distribution work for Linux with Rust? It's not going to be better than C, is it?
Kind regads,
Matthias
The text was updated successfully, but these errors were encountered: