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

Unable to control --debug / --release via PEP517 backend #327

Closed
mgorny opened this issue Apr 19, 2023 · 7 comments
Closed

Unable to control --debug / --release via PEP517 backend #327

mgorny opened this issue Apr 19, 2023 · 7 comments

Comments

@mgorny
Copy link

mgorny commented Apr 19, 2023

Unless I'm mistaken, there is no way to pass --debug / --release argument to build_rust when building via the PEP517 backend.

@davidhewitt
Copy link
Member

I think you're correct. Unless things have changed, I don't think PEP517 gives a mechanism to pass arguments to the build backend in general.

This was solved in maturin with MATURIN_PEP517_ARGS env var. See PyO3/maturin#786

I'd accept a PR to achieve a similar control via env var here, though the design might be a bit different.

@mgorny
Copy link
Author

mgorny commented Apr 27, 2023

I think you're correct. Unless things have changed, I don't think PEP517 gives a mechanism to pass arguments to the build backend in general.

Actually, PEP517 provides a config_settings dict that can be used to pass options to the backend. However, I don't think that setuptools provides a way for plugins to utilize it.

That said, I'm not really sure because the code is very complex and unreadable to me, and it's undocumented.

@davidhewitt
Copy link
Member

Hmm, reading around a little, I think we can try to support something like

python -m build -C--build-option=--rust-debug

Looks like all PEP517 arguments to setuptools builds must go under the --build-option and --global-option namespaces like this.

@mgorny
Copy link
Author

mgorny commented Apr 27, 2023

Thinking about it, I'd prefer environment variable approach — if only because it means we can set it globally and not have to worry whether the package in question uses setuptools-rust or not.

@davidhewitt
Copy link
Member

Since 1.8.0 we now have SETUPTOOLS_RUST_CARGO_PROFILE, which should meet this need.

Note that for --debug, the profile is called dev, i.e. SETUPTOOLS_RUST_CARGO_PROFILE=dev. (This was a choice made by cargo for a reason which I am not privy to.)

@mgorny
Copy link
Author

mgorny commented Jan 2, 2024

Thanks! FWICS, maturin uses dev also, so that's consistent.

@davidhewitt
Copy link
Member

Yes I think maturin also inherited this from cargo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants