Skip to content

maturin build creates non-universal binary wheels #2423

@mhils

Description

@mhils

Bug Description

maturin build creates non-universal wheels for bin crates if there are pyo3 crates in the same workspace. Instead of generating

bar-0.1.0-py3-none-macosx_11_0_arm64.whl

it generates

bar-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
`maturin build` log
$ RUST_LOG=maturin=debug maturin build
2025-01-03T19:14:19.914006Z  INFO into_build_context: maturin::build_options: close time.busy=2.38µs time.idle=3.29µs
2025-01-03T19:14:19.915089Z DEBUG maturin::project_layout: Found pyproject.toml in working directory at "/Users/mhils/git/repro/bar/pyproject.toml"
2025-01-03T19:14:19.915526Z DEBUG maturin::project_layout: Using cargo manifest path from working directory: "/Users/mhils/git/repro/bar/Cargo.toml"
2025-01-03T19:14:19.915837Z DEBUG resolve_cargo_metadata: maturin::project_layout: Resolving cargo metadata from "/Users/mhils/git/repro/bar/Cargo.toml"
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
2025-01-03T19:14:20.007277Z  INFO resolve_cargo_metadata: maturin::project_layout: close time.busy=91.4ms time.idle=750ns
2025-01-03T19:14:20.007552Z DEBUG maturin::project_layout: Project layout resolved project_root=/Users/mhils/git/repro/bar python_dir=/Users/mhils/git/repro/bar rust_module=/Users/mhils/git/repro/bar/bar python_module=/Users/mhils/git/repro/bar/bar extension_name=bar module_name=bar
2025-01-03T19:14:20.125459Z DEBUG check_executable: maturin::python_interpreter: Found CPython interpreter at /Users/mhils/git/mitmproxy/venv/bin/python executable=python
2025-01-03T19:14:20.125481Z  INFO check_executable: maturin::python_interpreter: close time.busy=72.9ms time.idle=1.33µs executable=python
🐍 Found CPython 3.12 at /Users/mhils/git/mitmproxy/venv/bin/python
📡 Using build options bindings from pyproject.toml
2025-01-03T19:14:20.125598Z DEBUG build_wheels: maturin::compile: Setting PYO3_PYTHON to /Users/mhils/git/mitmproxy/venv/bin/python
💻 Using `MACOSX_DEPLOYMENT_TARGET=11.0` for aarch64-apple-darwin by default
2025-01-03T19:14:20.173561Z DEBUG build_wheels: maturin::compile: Running env -u CARGO MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.12-64bit" PYO3_PYTHON="/Users/mhils/git/mitmproxy/venv/bin/python" PYTHON_SYS_EXECUTABLE="/Users/mhils/git/mitmproxy/venv/bin/python" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/Users/mhils/git/repro/bar/Cargo.toml" "--bin" "bar"
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
2025-01-03T19:14:20.329080Z DEBUG build_wheels: maturin::module_writer: Adding bar-0.1.0.dist-info/METADATA
2025-01-03T19:14:20.329183Z DEBUG build_wheels: maturin::module_writer: Adding bar-0.1.0.dist-info/WHEEL
2025-01-03T19:14:20.329505Z DEBUG build_wheels: maturin::module_writer: Adding bar-0.1.0.data/scripts/bar from /Users/mhils/git/repro/target/debug/bar
2025-01-03T19:14:20.347534Z DEBUG build_wheels: maturin::module_writer: Adding bar-0.1.0.dist-info/RECORD
📦 Built wheel to /Users/mhils/git/repro/target/wheels/bar-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
2025-01-03T19:14:20.347999Z  INFO build_wheels: maturin::build_context: close time.busy=222ms time.idle=875ns

Your maturin version (maturin --version)

1.8.1

Your Python version (python -V)

3.12.8

Your pip version (pip -V)

23.3.1

What bindings you're using

bin

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

$ printf "[workspace]\nmembers = ['foo','bar']" > Cargo.toml
$ maturin init --bindings pyo3 foo
  ✨ Done! Initialized project foo
$ maturin init --bindings bin bar
  ✨ Done! Initialized project bar
$ cd bar
$ maturin build

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions