Move setuptools-rust documentation to setuptools-rust

This commit is contained in:
konstin 2018-09-06 18:03:15 +02:00
parent 4c1ff24b2b
commit f3c98ca7ba
2 changed files with 2 additions and 52 deletions

View File

@ -115,6 +115,7 @@ fn main() -> PyResult<()> {
* [examples/word-count](examples/word-count) _Counting the occurences of a word in a text file_
* [hyperjson](https://github.com/mre/hyperjson) _A hyper-fast Python module for reading/writing JSON data using Rust's serde-json_
* [rust-numpy](https://github.com/rust-numpy/rust-numpy) _Rust binding of NumPy C-API_
* [html-py-ever](https://github.com/PyO3/setuptools-rust/tree/master/html-py-ever) _Using [html5ever](https://github.com/servo/html5ever) through [kuchiki](https://github.com/kuchiki-rs/kuchiki) to speed up html parsing and css-selecting._
* [pyo3-built](https://github.com/PyO3/pyo3-built) _Simple macro to expose metadata obtained with the [`built`](https://crates.io/crates/built) crate as a [`PyDict`](https://pyo3.github.io/pyo3/pyo3/struct.PyDict.html)_
* [point-process](https://github.com/ManifoldFR/point-process-rust/tree/master/pylib) _High level API for pointprocesses as a Python library_

View File

@ -1,54 +1,3 @@
# Distribution
## `setuptools-rust` integration
[`setuptools-rust`][setuptools-rust] is a setuptools helpers for Rust Python extensions. It supports `PyO3` by default.
For detailed usage, please refer to its [README](https://github.com/PyO3/setuptools-rust/blob/master/README.rst)
## Source distribution
To build a source code distribution, you need to add the following lines to your `MANIFEST.in` file to ensure it correctly packages Rust extension source code.
```text
include Cargo.toml
recursive-include src *
```
Then you can build a source code distribution by (assuming you have already written a `setup.py`):
```bash
python setup.py sdist
```
## Binary wheel distribution
To build a binary wheel, [manylinux](https://github.com/pypa/manylinux) would be a natural choice for Linux.
Take the [example](https://github.com/PyO3/setuptools-rust/tree/master/example) project in [`setuptools-rust`][setuptools-rust] repository for example,
we have a [`build-wheels.sh`](https://github.com/PyO3/setuptools-rust/blob/master/example/build-wheels.sh) to be used with Docker to build manylinux1 wheels.
First you need to pull the `manylinux1` Docker image:
```bash
$ docker pull quay.io/pypa/manylinux1_x86_64
```
Then use the following command to build wheels for supported Python versions:
```bash
$ docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/build-wheels.sh
```
You will find all the wheels in `dist` directory:
```bash
$ ls dist
hello_rust-1.0-cp27-cp27m-linux_x86_64.whl hello_rust-1.0-cp35-cp35m-linux_x86_64.whl
hello_rust-1.0-cp27-cp27m-manylinux1_x86_64.whl hello_rust-1.0-cp35-cp35m-manylinux1_x86_64.whl
hello_rust-1.0-cp27-cp27mu-linux_x86_64.whl hello_rust-1.0-cp36-cp36m-linux_x86_64.whl
hello_rust-1.0-cp27-cp27mu-manylinux1_x86_64.whl hello_rust-1.0-cp36-cp36m-manylinux1_x86_64.whl
```
The `*-manylinux1_x86_64.whl` files are the `manylinux1` wheels that you can upload to PyPI.
[setuptools-rust]: https://github.com/PyO3/setuptools-rust
There are two way to distribute your module as python package: The old [setuptools-rust](https://github.com/PyO3/setuptools-rust) and the new [pyo3-pack](https://github.com/pyo3/pyo3-pack). setuptools-rust needs some configuration files (`setup.py`, `MANIFEST.in`, `build-wheels.sh`, etc.) and external tools (docker, twine). pyo3-pack doesn't need any configuration files. It can not yet build sdist though ([pyo3/pyo3-pack#2](https://github.com/PyO3/pyo3-pack/issues/2)).