-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Use [tool.maturin]
options from pyproject.toml
in build command
#605
Conversation
[tool.maturin]
settings of pyproject.toml
[tool.maturin]
options from pyproject.toml
in build command
9cec7b4
to
1031f77
Compare
(going to try to review this later tonight) ... edit: gonna need to wait for another day, I'm exhausted 😴 |
src/build_options.rs
Outdated
if cargo_extra_args.is_empty() { | ||
// if not supplied on command line, try pyproject.toml | ||
if let Some(args) = pyproject.and_then(|x| x.cargo_extra_args()) { | ||
cargo_extra_args.push(args.to_string()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how to communicate to the user when some setting was loaded from tool.maturin.some-field
and when the cli overwrote tool.maturin.some-field
. Maybe it a generic "loading configuration from [tool.maturin]
" and some message for which fields the cli overwrote the [tool.maturin]
values. Otherwise it could be rather confusing if you e.g. git pull
a project, run maturin build
and then get an error that only occurs because [tool.maturin]
overwrote some logic when the defaults would have worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. We certainly should inform user that we used configuration from [tool.maturin]
section.
I think we can also drop the cli arguments passing on the Python PEP 517 support side now that maturin reads it on the Rust side, the |
I think |
(It sounds like you two have got this so I'm going to assume I'm not needed any more. Ping me if you do need me to review later!) |
|
||
if !args_from_pyproject.is_empty() { | ||
eprintln!( | ||
"📡 Using build options {} from pyproject.toml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 emoji choice
why can the |
Since the merge of PyO3/maturin#605 , we can add features flag when maturin build the python project, removing the need to always enabling `extension-module` flag when building. The `extension-module` flag creates crash when building and testing outside of maturin. Previous fix required to disable default feature flag when building and testing which is not ideal.
maturin build
should respect these settings even when not building using PEP 517maturin/maturin/__init__.py
Lines 26 to 34 in a37c450
The primary use case of this feature is that when a crate have an off-by-default optional feature say
pyo3
to enable Python extension module, user can specifycargo-extra-args = "--features pyo3"
inpyproject.toml
to automatically "pass" them tomaturin build
/maturin publish