Skip to content

maturin keeps [workspace] table in Cargo.toml but doesn't include actual workspace directories in sdist #1226

Description

@decathorpe

Bug Description

I have this workspace definition in my root Cargo.toml file:

[workspace]
members = [
    ".",
    "test-client",
]

The python package with pyo3 bindings is the crate in the root . directory, and the test-client is a separate binary.

When building an sdist, maturin keeps this workspace table unmodified, but does not include the test-client directory in the sdist, which actually breaks building the crate from sdist sources (because cargo can't find the test-client directory if it's not there), see decathorpe/mitmproxy_wireguard#18 for a bug report I got.

The complete Cargo.toml of the affected project is here:
https://github.com/decathorpe/mitmproxy_wireguard/blob/main/Cargo.toml


cargo publish handles this case by dropping the [workspace] table from Cargo.toml for crates that are uploaded on crates.io, but I'm not sure if that simple solution is going to work for maturin (as I think it does support building projects that are split across many workspace components).

Is there a way to tell maturin to include the directories which are mentioned in the [workspace] definition even though they're not used to build the actual Python wheel? That would let me work around the problem.

Your Python version (python -V)

Python 3.11.0

Your pip version (pip -V)

pip 22.3

What bindings you're using

pyo3

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

  1. use a Cargo.toml that has both [package] + [workspace] tables
  2. run maturin sdist
  3. the tarball doesn't all the sources necessary to build the crate

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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