maturin icon indicating copy to clipboard operation
maturin copied to clipboard

License file being deleted in Cargo workspace

Open krokosik opened this issue 6 months ago • 10 comments

Bug Description

Maturin v1.9.0 introduced a new license handling mechanism in #2571

This caused our workspace to be impossible to build now, as the tool now deletes our license file and then fails due to lack of license file.

💥 maturin failed
  Caused by: Failed to read C:\fake-workspace-path\host\..\LICENSE
  Caused by: failed to open file `C:\fake-workspace-path\host\..\LICENSE`: The system cannot find the file specified. (os error 2)

I tried working around it by manually setting the path in pyproject.toml, but this also fails, because parent directory operator .. is not allowed.

Your maturin version (maturin --version)

1.9.0

Your Python version (python -V)

3.11.10

Your pip version (pip -V)

23.0.1

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 /)?

  • [x] Yes

Steps to Reproduce

  1. Create a cargo workspace with a crate that uses maturin
  2. Create a LICENSE file in the root folder and specify it in the root Cargo.toml
  3. In the crate Cargo.toml, use license-file.workspace = true
  4. Try executing maturin develop

krokosik avatar Jun 25 '25 15:06 krokosik

Sorry I'm not sure what you meant by deleted, #2571 is not merged, the change in #2647 does not delete anything.

Please create a minimal repro in a public git repository, otherwise it's going to take more time for this to be resolved.

messense avatar Jul 01 '25 13:07 messense

@messense sorry, my bad. I linked the wrong issue. Here is the minimal repo: https://github.com/krokosik/maturin-2664

krokosik avatar Jul 01 '25 13:07 krokosik

I'm unable to reproduce this on macOS.

maturin-2664/host on  main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ uv run maturin develop
Uninstalled 1 package in 1ms
Installed 1 package in 2ms
🔗 Found pyo3 bindings with abi3 support
🐍 Not using a specific python interpreter
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
📦 Built wheel for abi3 Python ≥ 3.9 to /var/folders/wv/3487fygn67qfcw9j29b2gyyh0000gn/T/.tmpl5wjb8/rustpill_clients-0.1.5-cp39-abi3-macosx_11_0_arm64.whl
✏️ Setting installed package as editable
🛠 Installed rustpill_clients-0.1.5

maturin-2664/host on  main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

maturin-2664/host on  main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ file ../LICENSE
../LICENSE: ASCII text

messense avatar Jul 01 '25 14:07 messense

I don't own a Windows machine, maybe you can try maturin generate-ci and try to repro it on github actions?

messense avatar Jul 01 '25 14:07 messense

I'm on it, curiously maturin build does not delete the LICENSE even on my PC

krokosik avatar Jul 01 '25 15:07 krokosik

Okay, the CI is ready. Do you want access to the repo?

krokosik avatar Jul 01 '25 15:07 krokosik

I think we might be running into something similar in our conda-forge builds for ruff, if it helps: https://github.com/conda-forge/ruff-feedstock/runs/45139246899. Only the Windows build is failing.

ntBre avatar Jul 01 '25 15:07 ntBre

Yeah, in the repro repo, the Linux runner passes, so it's only Windows

krokosik avatar Jul 01 '25 16:07 krokosik

what happens if you do a maturin develop first, restore the deleted license file then run maturin develop --skip-install so it does not call uv pip/pip again? This could isolate the issue to maturin or uv pip/pip.

messense avatar Jul 02 '25 01:07 messense

Woops, I missed this response. Problem is I switched my dev workspace to Linux in the meantime 😓

krokosik avatar Nov 12 '25 16:11 krokosik