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

Warn about unknown config keys in PYO3_CONFIG_FILE #2926

Merged
merged 1 commit into from
Jan 29, 2023

Conversation

messense
Copy link
Member

maturin also read from PYO3_CONFIG_FILE to get ext_suffix config, pyo3-build-config currently denies unknown config keys makes it inconvenient.

See PyO3/maturin#1430

@messense messense force-pushed the warn-unknown-config-keys branch from c94bcf3 to f8e2a26 Compare January 29, 2023 02:49
@messense
Copy link
Member Author

bors r=adamreichold

bors bot added a commit that referenced this pull request Jan 29, 2023
2926: Warn about unknown config keys in `PYO3_CONFIG_FILE` r=adamreichold a=messense

`maturin` also read from `PYO3_CONFIG_FILE` to get `ext_suffix` config, `pyo3-build-config` currently denies unknown config keys makes it inconvenient.

See PyO3/maturin#1430

Co-authored-by: messense <messense@icloud.com>
@adamreichold
Copy link
Member

adamreichold commented Jan 29, 2023

bors r=adamreichold

I am sorry, I should have spelled that out: I approved only via the GitHub UI and not via bors to give other interested parties time to have a look and comment before this lands. I often want to attach something to indicate that I reviewed a PR, even though I am not yet confident enough to start merging.

@messense
Copy link
Member Author

No problem!

bors r-

@bors
Copy link
Contributor

bors bot commented Jan 29, 2023

Canceled.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me too!

@messense - just as a double-check before merging, can you confirm that the warning can be seen by the user? I got the impression that cargo hides the warnings except when build fails. Maybe try building one of the examples on this branch with a config file with a typo in it and see what happens?

If the user never sees this warning, it might be more robust to instead keep error-by-default and add an env var to allow unknown keys e.g. PYO3_CONFIG_ALLOW_UNKOWN_KEYS=ext_suffix

@messense
Copy link
Member Author

just as a double-check before merging, can you confirm that the warning can be seen by the user?

Yes.

🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.12
💻 Using `MACOSX_DEPLOYMENT_TARGET=11.0` for aarch64-apple-darwin by default
   Compiling pyo3-build-config v0.18.0 (/Users/messense/Projects/pyo3/pyo3-build-config)
warning: unknown config key `ext_suffix`
   Compiling pyo3-ffi v0.18.0 (/Users/messense/Projects/pyo3/pyo3-ffi)
   Compiling pyo3 v0.18.0 (/Users/messense/Projects/pyo3)
   Compiling word-count v0.1.0 (/Users/messense/Projects/pyo3/examples/word-count)
    Finished dev [unoptimized + debuginfo] target(s) in 1.37s
📦 Built wheel for CPython 3.12 to dist/word_count-0.1.0-cp312-cp312-macosx_11_0_arm64.whl

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@davidhewitt
Copy link
Member

Great! If you ever want to adjust the UX for maturin here so that the warning doesn't show for ext_suffix, a follow-up PR to add the env var to silence the warning for specific keys would seem reasonable to me 👍

@bors
Copy link
Contributor

bors bot commented Jan 29, 2023

Build succeeded:

  • conclusion

@bors bors bot merged commit 3149a80 into PyO3:main Jan 29, 2023
@messense messense deleted the warn-unknown-config-keys branch January 29, 2023 11:28
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

Successfully merging this pull request may close these issues.

3 participants