Use [tool.maturin] options from pyproject.toml in build command#605
Use [tool.maturin] options from pyproject.toml in build command#605
[tool.maturin] options from pyproject.toml in build command#605Conversation
[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 😴 |
| 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.
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.
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", |
|
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 buildshould 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
pyo3to enable Python extension module, user can specifycargo-extra-args = "--features pyo3"inpyproject.tomlto automatically "pass" them tomaturin build/maturin publish