uv
uv copied to clipboard
How can I integrate `tox` into `uv`?
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.
https://tox.wiki/en/latest/config.html#install_command looks to be a possible solution to putting uv in place of pip
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
@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).
@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?
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.
python -m build --sdist do not follow any spec?
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
Related to #313
tox devs published owns tox-uv plugin https://github.com/tox-dev/tox-uv (but it crashes tox in my case)
@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.
Closing as tox-uv now exists!