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

Expose commonly used Cargo CLI options in maturin build command #972

Merged
merged 8 commits into from
Jun 19, 2022

Conversation

messense
Copy link
Member

@messense messense commented Jun 18, 2022

New maturin build cli example:

$ maturin build --help
maturin-build 
Build the crate into python packages

USAGE:
    maturin build [OPTIONS] [--] [ARGS]...

ARGS:
    <ARGS>...
            Rustc flags

OPTIONS:
    -r, --release
            Build artifacts in release mode, with optimizations

        --strip
            Strip the library for minimum file size

        --sdist
            Build a source distribution

        --compatibility <compatibility>...
            Control the platform tag on linux.
            
            Options are `manylinux` tags (for example `manylinux2014`/`manylinux_2_24`) or
            `musllinux` tags (for example `musllinux_1_2`) and `linux` for the native linux tag.
            
            Note that `manylinux1` is unsupported by the rust compiler. Wheels with the native
            `linux` tag will be rejected by pypi, unless they are separately validated by
            `auditwheel`.
            
            The default is the lowest compatible `manylinux` tag, or plain `linux` if nothing
            matched
            
            This option is ignored on all non-linux platforms

    -i, --interpreter <INTERPRETER>...
            The python versions to build wheels for, given as the names of the interpreters. Uses
            autodiscovery if not explicitly set

    -f, --find-interpreter
            Find interpreters from the host machine

    -b, --bindings <BINDINGS>
            Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin

    -o, --out <OUT>
            The directory to store the built wheels in. Defaults to a new "wheels" directory in the
            project's target directory

        --skip-auditwheel
            Don't check for manylinux compliance

        --zig
            For manylinux targets, use zig to ensure compliance for the chosen manylinux version
            
            Default to manylinux2010/manylinux_2_12 if you do not specify an `--compatibility`
            
            Make sure you installed zig with `pip install maturin[zig]`

        --universal2
            Control whether to build universal2 wheel for macOS or not. Only applies to macOS
            targets, do nothing otherwise

    -q, --quiet
            Do not print cargo log messages

    -j, --jobs <N>
            Number of parallel jobs, defaults to # of CPUs

        --profile <PROFILE-NAME>
            Build artifacts with the specified Cargo profile

        --features <FEATURES>...
            Space or comma separated list of features to activate

        --all-features
            Activate all available features

        --no-default-features
            Do not activate the `default` feature

        --target <TRIPLE>
            Build for the target triple
            
            [env: CARGO_BUILD_TARGET=]

        --target-dir <DIRECTORY>
            Directory for all generated artifacts

    -m, --manifest-path <PATH>
            Path to Cargo.toml

        --ignore-rust-version
            Ignore `rust-version` specification in packages

    -v, --verbose
            Use verbose output (-vv very verbose/build.rs output)

        --color <WHEN>
            Coloring: auto, always, never

        --frozen
            Require Cargo.lock and cache are up to date

        --locked
            Require Cargo.lock is up to date

        --offline
            Run without accessing the network

        --config <KEY=VALUE>...
            Override a configuration value (unstable)

    -Z <FLAG>...
            Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details

        --timings[=<FMTS>...]
            Timing output formats (unstable) (comma separated): html, json

        --future-incompat-report
            Outputs a future incompatibility report at the end of the build (unstable)

    -h, --help
            Print help information

TODO:

  • Apply cargo options in cargo metadata and cargo rustc command
  • Read cargo options from pyproject.toml
  • Change maturin develop

Part of #796

@netlify
Copy link

netlify bot commented Jun 18, 2022

Deploy Preview for maturin-guide ready!

Name Link
🔨 Latest commit b37760e
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/62aefe1c43924f00084d9a9f
😎 Deploy Preview https://deploy-preview-972--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@messense messense mentioned this pull request Jun 18, 2022
6 tasks
@messense messense marked this pull request as ready for review June 19, 2022 01:07
@messense messense requested a review from konstin June 19, 2022 01:07
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

🎉

@@ -24,8 +24,9 @@ base64 = "0.13.0"
bytesize = "1.0.1"
glob = "0.3.0"
cargo_metadata = "0.14.0"
cargo-zigbuild = "0.9.0"
cargo-xwin = { version = "0.8.6", default-features = false }
cargo-options = "0.2.0"
Copy link
Member

Choose a reason for hiding this comment

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

this is neat

Changelog.md Outdated Show resolved Hide resolved
Co-authored-by: konstin <konstin@mailbox.org>
@messense messense merged commit efb6102 into PyO3:main Jun 19, 2022
@messense messense deleted the cargo-options branch June 19, 2022 11:25
@messense messense linked an issue Jun 19, 2022 that may be closed by this pull request
6 tasks
@messense messense removed a link to an issue Oct 10, 2022
6 tasks
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.

None yet

2 participants