Skip to content

Commit ebc9e82

Browse files
committed
deprecate RustExtension.py_limited_api
1 parent e374a56 commit ebc9e82

File tree

6 files changed

+13
-20
lines changed

6 files changed

+13
-20
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

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+
37
## 1.8.1 (2023-10-30)
48
### Fixed
59
- Fix regression in `install_extension` crashing since 1.8.0. [#380](https://github.com/PyO3/setuptools-rust/pull/380)

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ target = "hello_world._lib" # The last part of the name (e.g. "_lib") has to ma
5656
# but you can add a prefix to nest it inside of a Python package.
5757
path = "Cargo.toml" # Default value, can be omitted
5858
binding = "PyO3" # Default value, can be omitted
59-
py-limited-api = "auto" # Default value, can be omitted
6059
```
6160

6261
Each extension module should map directly into the corresponding `[lib]` table on the

examples/hello-world-setuppy/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# in Cargo.toml and the function name in the `.rs` file,
1515
# but you can add a prefix to nest it inside of a Python package.
1616
path="Cargo.toml", # Default value, can be omitted
17-
py_limited_api="auto", # Default value, can be omitted
1817
binding=Binding.PyO3, # Default value, can be omitted
1918
)
2019
],

examples/hello-world/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ find = { where = ["python"] }
1919
# Private Rust extension module to be nested into Python package
2020
target = "hello_world._lib" # The last part of the name (e.g. "_lib") has to match lib.name in Cargo.toml,
2121
# but you can add a prefix to nest it inside of a Python package.
22-
py-limited-api = "auto" # Default value, can be omitted
2322
binding = "PyO3" # Default value, can be omitted
2423
# See reference for RustExtension in https://setuptools-rust.readthedocs.io/en/latest/reference.html
2524

examples/rust_with_cffi/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
packages=find_packages(where="python"),
1818
package_dir={"": "python"},
1919
rust_extensions=[
20-
RustExtension("rust_with_cffi.rust", py_limited_api="auto"),
20+
RustExtension("rust_with_cffi.rust"),
2121
],
2222
cffi_modules=["cffi_module.py:ffi"],
2323
install_requires=["cffi"],

setuptools_rust/extension.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,7 @@ class RustExtension:
107107
optional: If it is true, a build failure in the extension will not
108108
abort the build process, and instead simply not install the failing
109109
extension.
110-
py_limited_api: Similar to ``py_limited_api`` on
111-
``setuptools.Extension``, this controls whether the built extension
112-
should be considered compatible with the PEP 384 "limited API".
113-
114-
- ``'auto'``: the ``py_limited_api`` option of
115-
``bdist_wheel`` will control whether the extension is
116-
built as a limited api extension. The corresponding
117-
``pyo3/abi3-pyXY`` feature will be set accordingly.
118-
This is the recommended setting, as it allows
119-
to build a version-specific extension for best performance.
120-
121-
- ``True``: the extension is assumed to be compatible with the
122-
limited abi. You must ensure this is the case (e.g. by setting
123-
the ``pyo3/abi3`` feature).
124-
125-
- ``False``: the extension is version-specific.
110+
py_limited_api: Deprecated.
126111
"""
127112

128113
def __init__(
@@ -180,6 +165,13 @@ def __init__(
180165
DeprecationWarning,
181166
)
182167

168+
if self.py_limited_api != "auto":
169+
warnings.warn(
170+
"`RustExtension.py_limited_api` is deprecated, use [bdist_wheel] configuration "
171+
"in `setup.cfg` or `DIST_EXTRA_CONFIG` to build abi3 wheels.",
172+
DeprecationWarning,
173+
)
174+
183175
def get_lib_name(self, *, quiet: bool) -> str:
184176
"""Parse Cargo.toml to get the name of the shared library."""
185177
metadata = self.metadata(quiet=quiet)

0 commit comments

Comments
 (0)