Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PEP 517 config_settings support #1619

Merged
merged 1 commit into from
May 20, 2023
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
6 changes: 4 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.15.2] - 2023-05-16

* When determining the python module name, use pyproject.toml `project.name` over Cargo.toml `package.name` in [#1608](https://github.com/PyO3/maturin/pull/1608)
* Fix rewriting `dev-dependencies` in sdist in [#1610](https://github.com/PyO3/maturin/pull/1610)
* When determining the python module name, use pyproject.toml `project.name` over Cargo.toml `package.name` in [#1608](https://github.com/PyO3/maturin/pull/1608)
* Fix rewriting `dev-dependencies` in sdist in [#1610](https://github.com/PyO3/maturin/pull/1610)
* Add PEP 517 `config_settings` support in [#1619](https://github.com/PyO3/maturin/pull/1619),
deprecate `MATURIN_PEP517_ARGS` in favor of the new `build-args` config setting.

## [0.15.1] - 2023-05-07

Expand Down
20 changes: 15 additions & 5 deletions maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ def get_config() -> Dict[str, str]:
return pyproject_toml.get("tool", {}).get("maturin", {})


def get_maturin_pep517_args() -> list[str]:
args = shlex.split(os.getenv("MATURIN_PEP517_ARGS", ""))
return args
def get_maturin_pep517_args(
config_settings: Mapping[str, Any] | None = None
) -> list[str]:
build_args = config_settings.get("build-args") if config_settings else None
if build_args is None:
args = os.getenv("MATURIN_PEP517_ARGS", "")
if args:
print(
f"'MATURIN_PEP517_ARGS' is deprecated, use `--config-settings build-args='{args}'` instead."
)
else:
args = build_args
return shlex.split(args)


def _additional_pep517_args() -> list[str]:
Expand Down Expand Up @@ -68,7 +78,7 @@ def _build_wheel(
if editable:
command.append("--editable")

pep517_args = get_maturin_pep517_args()
pep517_args = get_maturin_pep517_args(config_settings)
if pep517_args:
command.extend(pep517_args)

Expand Down Expand Up @@ -185,7 +195,7 @@ def prepare_metadata_for_build_wheel(
sys.executable,
]
command.extend(_additional_pep517_args())
pep517_args = get_maturin_pep517_args()
pep517_args = get_maturin_pep517_args(config_settings)
if pep517_args:
command.extend(pep517_args)

Expand Down
2 changes: 1 addition & 1 deletion test-crates/cffi-mixed/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/cffi-pure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/hello-world/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[tool.maturin]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/lib_with_disallowed_lib/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/lib_with_path_dep/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/license-test/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-ffi-pure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed-include-exclude/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed-py-subdir/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed-src/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed-submodule/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-pure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[tool.maturin]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/sdist_with_path_dep/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/sdist_with_target_path_dep/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/uniffi-mixed/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/uniffi-pure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/with-data/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion test-crates/workspace-inheritance/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/workspace/py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion test-crates/workspace_with_path_dep/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[tool.maturin]
Expand Down