|
1 | 1 | # Setuptools plugin for Rust extensions
|
2 | 2 |
|
3 |
| - |
4 |
| -[](https://badge.fury.io/py/setuptools-rust) |
| 3 | +[](https://github.com/PyO3/setuptools-rust/actions/workflows/ci.yml) |
| 4 | +[](https://pypi.org/project/setuptools-rust/) |
5 | 5 | [](https://setuptools-rust.readthedocs.io/en/latest/)
|
6 | 6 | [](https://github.com/ambv/black)
|
7 | 7 |
|
@@ -36,41 +36,20 @@ setup(
|
36 | 36 | For a complete reference of the options supported by the `RustExtension` class, see the
|
37 | 37 | [API reference](https://setuptools-rust.readthedocs.io/en/latest/reference.html).
|
38 | 38 |
|
39 |
| -### MANIFEST.in |
40 |
| - |
41 |
| -This file is required for building source distributions |
42 |
| - |
43 |
| -```text |
44 |
| -include Cargo.toml |
45 |
| -recursive-include src * |
46 |
| -``` |
47 |
| - |
48 | 39 | ### pyproject.toml
|
49 | 40 |
|
50 | 41 | ```toml
|
51 | 42 | [build-system]
|
52 | 43 | requires = ["setuptools", "wheel", "setuptools-rust"]
|
53 | 44 | ```
|
54 | 45 |
|
55 |
| -### build-wheels.sh |
56 |
| - |
57 |
| -```bash |
58 |
| -#!/bin/bash |
59 |
| -set -ex |
60 |
| - |
61 |
| -curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y |
62 |
| -export PATH="$HOME/.cargo/bin:$PATH" |
63 |
| - |
64 |
| -cd /io |
| 46 | +### MANIFEST.in |
65 | 47 |
|
66 |
| -for PYBIN in /opt/python/cp{35,36,37,38,39}*/bin; do |
67 |
| - "${PYBIN}/pip" install -U setuptools wheel setuptools-rust |
68 |
| - "${PYBIN}/python" setup.py bdist_wheel |
69 |
| -done |
| 48 | +This file is required for building source distributions |
70 | 49 |
|
71 |
| -for whl in dist/*.whl; do |
72 |
| - auditwheel repair "$whl" -w dist/ |
73 |
| -done |
| 50 | +```text |
| 51 | +include Cargo.toml |
| 52 | +recursive-include src * |
74 | 53 | ```
|
75 | 54 |
|
76 | 55 | ## Usage
|
@@ -98,47 +77,10 @@ Processing dependencies for hello_rust==1.0
|
98 | 77 | Finished processing dependencies for hello_rust==1.0
|
99 | 78 | ```
|
100 | 79 |
|
101 |
| -Or you can use commands like bdist_wheel (after installing wheel). |
| 80 | +Or you can use commands like ``bdist_wheel`` (after installing ``wheel``). See also [the notes in the documentation about building wheels](https://setuptools-rust.readthedocs.io/en/latest/building_wheels.html). |
102 | 81 |
|
103 | 82 | By default, `develop` will create a debug build, while `install` will create a release build.
|
104 | 83 |
|
105 |
| -### Binary wheels on linux |
106 |
| - |
107 |
| -To build binary wheels on linux, you need to use the [manylinux docker container](https://github.com/pypa/manylinux). You also need a `build-wheels.sh` similar to [the one in the example](https://github.com/PyO3/setuptools-rust/blob/main/examples/html-py-ever/build-wheels.sh), which will be run in that container. |
108 |
| - |
109 |
| -First, pull the `manylinux2014` Docker image: |
110 |
| - |
111 |
| -```bash |
112 |
| -docker pull quay.io/pypa/manylinux2014_x86_64 |
113 |
| -``` |
114 |
| - |
115 |
| -Then use the following command to build wheels for supported Python versions: |
116 |
| - |
117 |
| -```bash |
118 |
| -docker run --rm -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 bash /io/build-wheels.sh |
119 |
| -``` |
120 |
| - |
121 |
| -This will create wheels in the `dist` directory: |
122 |
| - |
123 |
| -```bash |
124 |
| -$ ls dist |
125 |
| -hello_rust-0.1.0-cp35-cp35m-linux_x86_64.whl hello_rust-0.1.0-cp35-cp35m-manylinux2014_x86_64.whl |
126 |
| -hello_rust-0.1.0-cp36-cp36m-linux_x86_64.whl hello_rust-0.1.0-cp36-cp36m-manylinux2014_x86_64.whl |
127 |
| -hello_rust-0.1.0-cp37-cp37m-linux_x86_64.whl hello_rust-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl |
128 |
| -hello_rust-0.1.0-cp38-cp38-linux_x86_64.whl hello_rust-0.1.0-cp38-cp38-manylinux2014_x86_64.whl |
129 |
| -hello_rust-0.1.0-cp39-cp39-linux_x86_64.whl hello_rust-0.1.0-cp39-cp39-manylinux2014_x86_64.whl |
130 |
| -``` |
131 |
| - |
132 |
| -You can then upload the `manylinux2014` wheels to pypi using [twine](https://github.com/pypa/twine). |
133 |
| - |
134 |
| -It is possible to use any of the `manylinux` docker images: `manylinux1`, `manylinux2010` or `manylinux2014`. (Just replace `manylinux2014` in the above instructions with the alternative version you wish to use.) |
135 |
| - |
136 |
| -### Binary wheels on macOS |
137 |
| - |
138 |
| -For building wheels on macOS it is sufficient to run the `bdist_wheel` command, i.e. `setup.py bdist_wheel`. |
139 |
| - |
140 |
| -To build `universal2` wheels set the `ARCHFLAGS` environment variable to contain both `x86_64` and `arm64`, for example `ARCHFLAGS="-arch x86_64 -arch arm64"`. Wheel-building solutions such as [`cibuildwheel`](https://github.com/joerick/cibuildwheel) set this environment variable automatically. |
141 |
| - |
142 | 84 | ## Commands
|
143 | 85 |
|
144 | 86 | - `build` - Standard build command will also build all rust extensions.
|
|
0 commit comments