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

maturin >= 1.2.1 fails to build workspace dependencies #1738

Closed
1 of 2 tasks
HerringtonDarkholme opened this issue Aug 16, 2023 · 3 comments · Fixed by #1739
Closed
1 of 2 tasks

maturin >= 1.2.1 fails to build workspace dependencies #1738

HerringtonDarkholme opened this issue Aug 16, 2023 · 3 comments · Fixed by #1739
Labels
bug Something isn't working sdist Source distribution

Comments

@HerringtonDarkholme
Copy link
Contributor

Bug Description

Hi. maturin >= 1.2.1 fails to build binary project with workspace dependencies.

This is my failing log. https://github.com/ast-grep/ast-grep/actions/runs/5880912791/job/15948245773

× Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      error: failed to parse manifest at `/tmp/pip-req-build-lsn898_p/crates/cli/Cargo.toml`
      
      Caused by:
        error inheriting `ast-grep-config` from workspace root manifest's `workspace.dependencies.ast-grep-config`
      
      Caused by:
        failed to find a workspace root
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-yxal7pqq', '--interpreter', '/opt/hostedtoolcache/Python/3.7.17/x64/bin/python']' returned non-zero exit status 1.

However, it build successfully with maturin=1.20.0

GH Action log: https://github.com/ast-grep/ast-grep/actions/runs/5881486702/job/15950058141
The change ast-grep/ast-grep@eb2b6a1


My project is https://github.com/ast-grep/ast-grep. The minimal project layout is like

.
├── Cargo.lock
├── Cargo.toml
├── crates
│   ├── cli
│   │   ├── Cargo.toml
│   │   ├── src
│   │   └── tests
│   ├── config
│   │   ├── Cargo.toml
│   │   └── src
│   ├── core
│   │   ├── Cargo.toml
│   │   └── src
├── pyproject.toml

Root Cargo.toml

[workspace]
members = [
  "crates/*",
]
default-members = ["crates/*"]

[workspace.dependencies]
ast-grep-core = { path = "crates/core", version = "0.11.0" }
ast-grep-config = { path = "crates/config", version = "0.11.0" }
# cli is not listed in dependcies

cli crate Cargo.toml

[dependencies]
ast-grep-core.workspace = true
ast-grep-config.workspace = true

Your maturin version (maturin --version)

1.2.1

Your Python version (python -V)

3.10.0

Your pip version (pip -V)

23.0.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

  sdist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ env.PYTHON_VERSION }}
      - name: "Build sdist"
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist
      - name: "Test sdist"
        run: |
          rustup default $(cat rust-toolchain)
          pip install dist/${{ env.PACKAGE_NAME }}-*.tar.gz --force-reinstall
          sg --hel
@HerringtonDarkholme HerringtonDarkholme added the bug Something isn't working label Aug 16, 2023
@messense
Copy link
Member

Thanks for the report!

Probably because I removed the following code in #1733:

if workspace_inherit {
// Remove workspace inheritance now that we converted it into a path dependency
dep_table[&dep_name]
.as_table_like_mut()
.unwrap()
.remove("workspace");
}

Could you please try add it back to see whether it fixes this issue, if you are interested? Pull requests are welcome. Otherwise I'll take a look after work.

@messense
Copy link
Member

Fix published in v1.2.3.

@HerringtonDarkholme
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sdist Source distribution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants