python-setuptools-rust
Port variant py38
Summary Setuptools Rust extension plugin (PY38)
Package version 0.12.1
Homepage https://github.com/PyO3/setuptools-rust
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py39
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 11 MAR 2021, 01:49:37 UTC
Port created 10 FEB 2021, 19:26:20 UTC
Subpackage Descriptions
single # Setuptools plugin for Rust extensions ![example workflow] [pypi package] [readthedocs] [![code style: black]](https://github.com/ambv/black) `setuptools-rust` is a plugin for `setuptools` to build Rust Python extensions implemented with [PyO3] or [rust-cpython]. Compile and distribute Python extensions written in Rust as easily as if they were written in C. ## Setup For a complete example, see [html-py-ever]. First, you need to create a bunch of files: ### setup.py ```python from setuptools import setup from setuptools_rust import Binding, RustExtension setup( name="hello-rust", version="1.0", rust_extensions=[RustExtension("hello_rust.hello_rust", binding=Binding.PyO3)], packages=["hello_rust"], # rust extensions are not zip safe, just like C-extensions. zip_safe=False, ) ``` For a complete reference of the options supported by the `RustExtension` class, see the [API reference]. ### MANIFEST.in This file is required for building source distributions ```text include Cargo.toml recursive-include src * ``` ### pyproject.toml ```toml [build-system] requires = ["setuptools", "wheel", "setuptools-rust"] ``` ### build-wheels.sh ```bash #!/bin/bash set -ex curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y export PATH="$HOME/.cargo/bin:$PATH" cd /io for PYBIN in /opt/python/cp{35,36,37,38,39}*/bin; do "${PYBIN}/pip" install -U setuptools wheel setuptools-rust "${PYBIN}/python" setup.py bdist_wheel done for whl in dist/*.whl; do auditwheel repair "$whl" -w dist/ done ``` ## Usage You can use same commands as for c-extensions. For example: ``` >>> python ./setup.py develop running develop running egg_info writing hello-rust.egg-info/PKG-INFO writing top-level names to hello_rust.egg-info/top_level.txt writing dependency_links to hello_rust.egg-info/dependency_links.txt reading manifest file 'hello_rust.egg-info/SOURCES.txt' writing manifest file 'hello_rust.egg-info/SOURCES.txt' running build_ext running build_rust cargo build --manifest-path extensions/Cargo.toml --features python3 Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs Creating /.../lib/python3.6/site-packages/hello_rust.egg-link (link to .) Installed hello_rust Processing dependencies for hello_rust==1.0
Configuration Switches (platform-specific settings discarded)
PY38 ON Build using Python 3.8 PY39 OFF Build using Python 3.9
Package Dependencies by Type
Build (only) python-pip:single:py38
autoselect-python:single:standard
Build and Runtime python38:single:standard
Runtime (only) python-setuptools:single:py38
python-semantic-version:single:py38
python-toml:single:py38
Download groups
main mirror://PYPIWHL/82/2b/349ad916a2f032506a2c7c0810950a299f96e05d88b21797c2170bd6b2c6
Distribution File Information
60c9bf1423a725e472c4a2a6274598251f959f3ed5ffe7698526e78bb431b9b7 22052 setuptools_rust-0.12.1-py3-none-any.whl
Ports that require python-setuptools-rust:py38
python-cryptography:py38 Cryptographic recipes and primitives (PY38)