Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = False
current_version = 1.11.1
current_version = 1.12.0
message = release: {new_version}

[bumpversion:file:pyproject.toml]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.12.0 (2025-08-29)
- Set `PYO3_BUILD_EXTENSION_MODULE` environment variable when building PyO3 extensions. [#540](https://github.com/PyO3/setuptools-rust/pull/540)

## 1.11.1 (2025-04-04)
### Fixed
- Fix finding cargo artifacts when filenames are empty. [#521](https://github.com/PyO3/setuptools-rust/pull/521)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "setuptools-rust"
version = "1.11.1"
version = "1.12.0"
description = "Setuptools Rust extension plugin"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
8 changes: 6 additions & 2 deletions setuptools_rust/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def build_extension(
target_triple = self._detect_rust_target(forced_target_triple, ext.env)
rustc_cfgs = get_rustc_cfgs(target_triple, ext.env)

env = _prepare_build_environment(ext.env)
env = _prepare_build_environment(ext.env, ext)

if not os.path.exists(ext.path):
raise FileError(
Expand Down Expand Up @@ -609,7 +609,7 @@ def _replace_vendor_with_unknown(target: str) -> Optional[str]:
return "-".join(components)


def _prepare_build_environment(env: Env) -> Dict[str, str]:
def _prepare_build_environment(env: Env, ext: RustExtension) -> Dict[str, str]:
"""Prepares environment variables to use when executing cargo build."""

base_executable = None
Expand All @@ -636,6 +636,10 @@ def _prepare_build_environment(env: Env) -> Dict[str, str]:
"PYO3_PYTHON": env_vars.get("PYO3_PYTHON", executable),
}
)

if ext.binding == Binding.PyO3:
env_vars.setdefault("PYO3_BUILD_EXTENSION_MODULE", "1")

return env_vars


Expand Down
2 changes: 1 addition & 1 deletion setuptools_rust/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = version = "1.11.1"
__version__ = version = "1.12.0"
__version_tuple__ = version_tuple = tuple(
map(lambda x: int(x[1]) if x[0] < 3 else x[1], enumerate(__version__.split(".")))
)
Loading