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

Support for publishing PyO3 libraries to PyPI #86

Open
djc opened this issue Feb 2, 2023 · 3 comments
Open

Support for publishing PyO3 libraries to PyPI #86

djc opened this issue Feb 2, 2023 · 3 comments

Comments

@djc
Copy link

djc commented Feb 2, 2023

I mostly build libraries and so have not felt much of a need to distribute pre-built binaries so far. However, one place I have noticed that binaries are more or less needed is several Python bindings I've built in tandem with Rust libraries. I think this pattern is increasingly popular (thanks to how awesome PyO3 is). Would you consider support for this in scope of cargo-dist?

For example, I recently wanted to publish a new version of the Python bindings for instant-distance. Unfortunately the Windows setup has somehow bitrotted (so the latest version has no Windows binaries up for now), and the newest Python release was not yet included.

@messense
Copy link

messense commented Feb 2, 2023

Hi, maturin maintainer here, I just want to chime in and tell you that the Windows issue is caused by Python 3.11 changed the behavior of the py launcher, to fix it you just need to update maturin version to latest (0.14) in pyproject.toml. (There are also some breaking changes in 0.13, so you'll also need to update some command line arguments, see https://github.com/PyO3/maturin/blob/main/guide/src/migration.md#from-012-to-013)

See also PyO3/maturin#1221.

@ashleygwilliams
Copy link
Member

https://pyo3.rs/v0.18.2/building_and_distribution

have been meeting a lotta folks in the data community who are using/interested in using py03. there's a few stages of py03 build support so could be achieved in iterative steps. not urgent but i think it'd be useful for us to have this on our radar/roadmap

@Gankra Gankra added this to the 0.2.0 milestone Aug 9, 2023
@Gankra Gankra removed this from the 0.3.0 milestone Aug 29, 2023
@konstin
Copy link

konstin commented Sep 29, 2023

There's effectively two distinct cases for publishing to pypi:

  • A python extension module using pyo3, cffi or similar bindings. In this case you build a dynamic library and have to consider things like different python versions and interpreter, so tagging, additional python files, package layout, etc.
  • Shipping a rust binary on pypi. This is what e.g. py-spy, ruff and maturin itself do. You only need to build a binary (ideally statically linked) and put it in a zip with some metadata file. This is really convenient if you're already working with python because it allows you to pipx run <tool> (the python equivalent to npx) or pip install <tool> and it will download the version for your platform, plus you can lock the version of the tool like a normal python dependency.

Personally, i would be very interested to get second one from cargo-dist because it's effectively just yet another way to pack archives and upload to a hoster.

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

No branches or pull requests

5 participants