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

How can I integrate tox into uv? #1484

Closed
paddyroddy opened this issue Feb 16, 2024 · 11 comments
Closed

How can I integrate tox into uv? #1484

paddyroddy opened this issue Feb 16, 2024 · 11 comments
Labels
question Asking for clarification or support

Comments

@paddyroddy
Copy link

I find that tox can take a long time to install dependencies (longer than doing it locally), it would be nice to benefit from uv for this. Think that the relevant bit in tox is here.

@zanieb zanieb added the question Asking for clarification or support label Feb 16, 2024
@atmartinez
Copy link

https://tox.wiki/en/latest/config.html#install_command looks to be a possible solution to putting uv in place of pip

@Czaki
Copy link
Contributor

Czaki commented Feb 16, 2024

No, It does not allow as uv is not installed in venv, and you cannot install it when you change install command...

To help myself with this task, I started implementing tox plugin. https://github.com/Czaki/tox-uv

But I hit the bug in uv it do not allow to install with full path to wheel file:

py311-macos-pyqt5-no_cov: install_package> python -I -m uv pip install --force-reinstall --no-deps /tmp/.tox/.tmp/package/5/napari-0.5.0a2.dev578+g17b00de2.tar.gz
error: Failed to parse `/tmp/.tox/.tmp/package/5/napari-0.5.0a2.dev578+g17b00de2.tar.gz`
  Caused by: Expected package name starting with an alphanumeric character, found '/'
/tmp/.tox/.tmp/package/5/napari-0.5.0a2.dev578+g17b00de2.tar.gz

@charliermarsh
Copy link
Member

@Czaki -- We can install via a full path, we just require a package name right now (like napari @ /tmp/.tox/.tmp/package/5/napari-0.5.0a2.dev578+g17b00de2.tar.gz).

@Czaki
Copy link
Contributor

Czaki commented Feb 16, 2024

@charliermarsh Ok. I do not control this part of tox, and it will need to do hacking that may not be stable. Why provide a full path to sdist or wheel is not enough and require extracting it from the file name?

@charliermarsh
Copy link
Member

It's just not implemented yet. In general, we can't read the package name from sdist files (like the one you linked -- that looks like an sdist?) since it doesn't follow any particular spec. Wheels do follow a spec and so we could read the package name from the filename in that case.

@Czaki
Copy link
Contributor

Czaki commented Feb 16, 2024

python -m build --sdist do not follow any spec?

@Czaki
Copy link
Contributor

Czaki commented Feb 16, 2024

Ok. I have created a workaround. It works nice with wheels, but end with error for sdist:

⠹ Resolving dependencies...                                                                              thread 'main' panicked at crates/uv-resolver/src/resolution.rs:120:26:
Every package should have metadata
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
py311-macos-pyqt5-no_cov: exit 101 (0.35 seconds) /Users/grzegorzbokota/Documents/Projekty/napari> python -I -m uv pip install --force-reinstall --no-deps 'napari @ /tmp/.tox/.tmp/package/7/napari-0.5.0a2.dev578+g17b00de2.tar.gz' pid=3499

@zanieb
Copy link
Member

zanieb commented Feb 16, 2024

Related to #313

@Czaki
Copy link
Contributor

Czaki commented Feb 16, 2024

tox devs published owns tox-uv plugin https://github.com/tox-dev/tox-uv (but it crashes tox in my case)

@gaborbernat
Copy link
Contributor

gaborbernat commented Feb 16, 2024

@charliermarsh now that https://pypi.org/project/tox-uv/ is launched, I think we can close this. Unless you want to document it somewhere, the advice to use that. sdists seem to still be troublesome occasionally, but otherwise work well.

@charliermarsh
Copy link
Member

Closing as tox-uv now exists!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

6 participants