You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# Changelog
2
2
3
+
## Unreleased
4
+
### Changed
5
+
- Deprecate `py_limited_api` option to `RustExtension` in favour of always using `"auto"` to configure this from `bdist_wheel`. [#410](https://github.com/PyO3/setuptools-rust/pull/410)
6
+
3
7
## 1.8.1 (2023-10-30)
4
8
### Fixed
5
9
- Fix regression in `install_extension` crashing since 1.8.0. [#380](https://github.com/PyO3/setuptools-rust/pull/380)
Copy file name to clipboardExpand all lines: docs/building_wheels.md
+25-8Lines changed: 25 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,36 @@ Because `setuptools-rust` is an extension to `setuptools`, the standard [`python
4
4
(or [`pip wheel --no-deps . --wheel-dir dist`](https://pip.pypa.io/en/stable/cli/pip_wheel/)) can be used to build distributable wheels.
5
5
These wheels can be uploaded to PyPI using standard tools such as [twine](https://github.com/pypa/twine).
6
6
7
-
`setuptools-rust` supports building for the [PEP 384](https://www.python.org/dev/peps/pep-0384/) "stable" (aka "limited") API when the `py_limited_api` option is set on the `[bdist_wheel]` section of `setup.cfg`.
8
-
If using PyO3 bindings for `RustExtension`, then the correct [`pyo3/abi3`](https://pyo3.rs/v0.14.5/features.html#abi3) sub-feature is automatically enabled.
9
-
In this way, abi3 wheels can be uploaded to make package distributors' roles easier, and package users installing from source with `pip install .` can use optimizations specific to their Python version.
7
+
A key choice to make is whether to upload [PEP 384](https://www.python.org/dev/peps/pep-0384/) "stable" (aka "limited") API wheels which support multiple Python versions in a single binary, or to build individual artifacts for each Python version. There is a longer discussion of this [in the PyO3 docs](https://pyo3.rs/latest/building_and_distribution#py_limited_apiabi3).
10
8
11
-
This chapter of the documentation explains two possible ways to build wheels for multiple Python versions below.
9
+
This chapter covers each of these options below.
12
10
13
-
## Using `cibuildwheel`
11
+
## Building for ABI3
12
+
13
+
`setuptools-rust` will automatically configure for the limited API when this is set in the `[bdist_wheel]` configuration section of [`setup.cfg`](https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html#writing-the-setup-configuration-file):
14
+
15
+
```ini
16
+
[bdist_wheel]
17
+
py_limited_api=cp37 # replace with desired minimum Python version
18
+
```
19
+
20
+
If using a `pyproject.toml`-based build, then save the above in a file and use the `DIST_EXTRA_CONFIG` environment variable to instruct `setuptools` to pick up this extra configuration. (`DIST_EXTRA_CONFIG` is documented [on this page](https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html#writing-the-setup-configuration-file) of the `setuptools` docs.)
21
+
22
+
It is also possible to pass this setting via the command line, e.g.
[`cibuildwheel`][cibuildwheel] is a tool to build wheels for multiple platforms using Github Actions.
16
33
17
34
The [`rtoml` package does this, for example](https://github.com/samuelcolvin/rtoml/blob/143ee0907bba616cbcd5cc58eefe9000fcc2b5f2/.github/workflows/ci.yml#L99-L195).
18
35
19
-
## Building manually
36
+
###Building manually
20
37
21
38
Place a script called `build-wheels.sh` with the following contents in your project root (next to the `setup.py` file):
22
39
@@ -27,7 +44,7 @@ Place a script called `build-wheels.sh` with the following contents in your proj
27
44
28
45
This script can be used to produce wheels for multiple Python versions.
29
46
30
-
### Binary wheels on linux
47
+
####Binary wheels on linux
31
48
32
49
To build binary wheels on linux, you need to use the [manylinux docker container](https://github.com/pypa/manylinux). You will run the `build-wheels.sh` from above inside that container.
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.)
56
73
57
-
### Binary wheels on macOS
74
+
####Binary wheels on macOS
58
75
59
76
For building wheels on macOS it is sufficient to use one of the default `python -m build` or `pip wheel --no-deps . --wheel-dir dist` commands.
0 commit comments