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

non-editable install with maturin develop --uv #2346

Closed
1 of 2 tasks
mbway opened this issue Nov 30, 2024 · 1 comment · Fixed by #2352
Closed
1 of 2 tasks

non-editable install with maturin develop --uv #2346

mbway opened this issue Nov 30, 2024 · 1 comment · Fixed by #2352
Labels
bug Something isn't working

Comments

@mbway
Copy link
Contributor

mbway commented Nov 30, 2024

Bug Description

if maturin develop --uv is used with an environment created with uv venv, the package is not installed in editable mode. This is likely because pip is not available in the environment and there is no fallback (but I'm not sure why fix_direct_url() isn't crashing).

Since uv 0.4.25 the tool has supported uv pip show --files so assuming maturin is OK with requiring at least this version, the fallback to always use pip in fix_direct_url() can be removed.

uv version: 0.5.5

Your maturin version (maturin --version)

maturin 1.7.6

Your Python version (python -V)

Python 3.12.2

Your pip version (pip -V)

pip 24.0

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

The following script installs the foobar package in non-editable mode when USE_UV=1 and in editable mode when USE_UV=0 (the package is also installed in editable mode when using maturin develop --uv if the environment is created with venv):

set -e
OUT=/tmp/minimal
USE_UV=1
rm -rf $OUT

if [ $USE_UV -eq 1 ]; then
    uv venv $OUT/venv
else
    python -m venv $OUT/venv
fi

. $OUT/venv/bin/activate

maturin new --name foobar --bindings pyo3 $OUT/foobar
cd $OUT/foobar

if [ $USE_UV -eq 1 ]; then
    maturin develop --uv
else
    maturin develop
fi

uv pip list
@mbway mbway added the bug Something isn't working label Nov 30, 2024
@messense
Copy link
Member

messense commented Dec 1, 2024

Pull requests are welcome!

messense pushed a commit that referenced this issue Dec 1, 2024
Before uv 0.4.25, `uv pip show` did not support the `--files` argument
which is required by `fix_direct_url`. Now that the flag is supported,
falling back to pip is not necessary.

Error handling is also improved. Previously if pip was not present in
the environment (which is the case for `uv venv`) no error was reported
to the user but `fix_direct_url` will have failed so the package is not
installed in editable mode.

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

Successfully merging a pull request may close this issue.

2 participants