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

Enable uv usage in pdm config #12

Open
ncoghlan opened this issue Oct 18, 2024 · 1 comment
Open

Enable uv usage in pdm config #12

ncoghlan opened this issue Oct 18, 2024 · 1 comment
Labels
BLOCKED Progress is blocked by an external dependency Category: Maintainability Proposed improvement to project maintainability CI (Automation) Continuous integration (and other automation)

Comments

@ncoghlan
Copy link
Collaborator

ncoghlan commented Oct 18, 2024

pdm 2.19+ includes uv support: https://pdm-project.org/latest/usage/uv/

Assuming venvstacks doesn't hit any of the noted limitations, enabling that should speed up both CI and local tox invocations.

Edit: currently blocked, as it looks like tox-pdm doesn't handle uv yet.

@ncoghlan ncoghlan added CI (Automation) Continuous integration (and other automation) Category: Maintainability Proposed improvement to project maintainability labels Oct 18, 2024
@ncoghlan
Copy link
Collaborator Author

ncoghlan commented Oct 29, 2024

Testing process:

$ pdm config --local use_uv true
$ tox -rm test_all

With the following versions:

$ pdm --version
PDM, version 2.19.3
$ tox --version
4.21.2 from /usr/lib/python3.12/site-packages/tox/__init__.py
registered plugins:
    tox-pdm-0.7.2 at /home/acoghlan/.local/lib/python3.12/site-packages/tox_pdm/plugin.py

That currently fails spectacularly:

$ tox -rm test_all
py3.11: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.11
.pkg: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/.pkg
py3.11: install_deps> pdm sync --no-self --group dev
INFO: Inside an active virtualenv /home/acoghlan/devel/venvstacks/.tox/py3.11, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
INFO: Using uv is experimental and might break due to uv updates.
warning: `VIRTUAL_ENV=.tox/py3.11` does not match the project environment path `.venv` and will be ignored
Using CPython 3.11.10 interpreter at: .tox/py3.11/bin/python
Removed virtual environment at: .venv
Creating virtual environment at: .venv
⠙ Preparing packages... (0/60)
thread 'main' panicked at crates/uv-distribution-types/src/file.rs:154:32:
called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
See /home/acoghlan/.local/state/pdm/log/pdm-install-hwmyoegf.log for detailed debug log.
[CalledProcessError]: Command '['/home/acoghlan/.local/bin/uv', 'sync', '--all-extras', '--frozen', '-p',
'/home/acoghlan/devel/venvstacks/.tox/py3.11/bin/python', '--inexact', '--no-install-project', '--index-url',
'https://pypi.org/simple']' returned non-zero exit status 101.
WARNING: Add '-v' to see the detailed traceback
py3.11: exit 1 (1.06 seconds) /home/acoghlan/devel/venvstacks> pdm sync --no-self --group dev pid=67803
py3.12: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.12
py3.11: FAIL ✖ in 1.57 seconds
py3.12: install_deps> pdm sync --no-self --group dev
INFO: Inside an active virtualenv /home/acoghlan/devel/venvstacks/.tox/py3.12, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
INFO: Using uv is experimental and might break due to uv updates.
warning: `VIRTUAL_ENV=.tox/py3.12` does not match the project environment path `.venv` and will be ignored
Using CPython 3.12.6 interpreter at: .tox/py3.12/bin/python
Removed virtual environment at: .venv
Creating virtual environment at: .venv
⠙ Preparing packages... (0/60)
thread 'main' panicked at crates/uv-distribution-types/src/file.rs:154:32:
called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
See /home/acoghlan/.local/state/pdm/log/pdm-install-a0mq1saj.log for detailed debug log.
[CalledProcessError]: Command '['/home/acoghlan/.local/bin/uv', 'sync', '--all-extras', '--frozen', '-p',
'/home/acoghlan/devel/venvstacks/.tox/py3.12/bin/python', '--inexact', '--no-install-project', '--index-url',
'https://pypi.org/simple']' returned non-zero exit status 101.
WARNING: Add '-v' to see the detailed traceback
py3.12: exit 1 (0.51 seconds) /home/acoghlan/devel/venvstacks> pdm sync --no-self --group dev pid=67859
py3.13: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.13
py3.12: FAIL ✖ in 0.88 seconds
py3.13: install_deps> pdm sync --no-self --group dev
INFO: Inside an active virtualenv /home/acoghlan/devel/venvstacks/.tox/py3.13, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
INFO: Using uv is experimental and might break due to uv updates.
warning: `VIRTUAL_ENV=.tox/py3.13` does not match the project environment path `.venv` and will be ignored
Using CPython 3.13.0 interpreter at: .tox/py3.13/bin/python
Removed virtual environment at: .venv
Creating virtual environment at: .venv
⠙ Preparing packages... (0/60)
thread 'main' panicked at crates/uv-distribution-types/src/file.rs:154:32:
called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
See /home/acoghlan/.local/state/pdm/log/pdm-install-6hox4qze.log for detailed debug log.
[CalledProcessError]: Command '['/home/acoghlan/.local/bin/uv', 'sync', '--all-extras', '--frozen', '-p',
'/home/acoghlan/devel/venvstacks/.tox/py3.13/bin/python', '--inexact', '--no-install-project', '--index-url',
'https://pypi.org/simple']' returned non-zero exit status 101.
WARNING: Add '-v' to see the detailed traceback
py3.13: exit 1 (0.54 seconds) /home/acoghlan/devel/venvstacks> pdm sync --no-self --group dev pid=67891
  py3.11: FAIL code 1 (1.57 seconds)
  py3.12: FAIL code 1 (0.88 seconds)
  py3.13: FAIL code 1 (0.94 seconds)
  evaluation failed :( (3.43 seconds)

Removing pdm.toml again restores the expected behaviour:

$ tox -rm test_all
py3.11: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.11
.pkg: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/.pkg
py3.11: install_deps> pdm sync --no-self --group dev
.pkg: install_requires> python -I -m pip install pdm-backend
.pkg: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True pdm.backend
.pkg: get_requires_for_build_wheel> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True pdm.backend
.pkg: build_wheel> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True pdm.backend
py3.11: install_package> python -I -m pip install --force-reinstall --no-deps /home/acoghlan/devel/venvstacks/.tox/.tmp/package/974/venvstacks-0.1.0rc1-py3-none-any.whl
py3.11: commands[0]> pytest -m 'not slow' tests/
================================================= test session starts ==================================================
platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
cachedir: .tox/py3.11/.pytest_cache
rootdir: /home/acoghlan/devel/venvstacks
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, subtests-0.13.1
collected 116 items / 2 deselected / 114 selected

tests/test_basics.py ...                                                                                         [  2%]
tests/test_cli_invocation.py ...........................................................................         [ 68%]
tests/test_hashing.py ................                                                                           [ 82%]
tests/test_index_config.py ......                                                                                [ 87%]
tests/test_minimal_project.py .........                                                                          [ 95%]
tests/test_sample_project.py .....                                                                               [100%]

========================================== 114 passed, 2 deselected in 1.51s ===========================================
py3.12: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.12
py3.11: OK ✔ in 12.53 seconds
py3.12: install_deps> pdm sync --no-self --group dev
py3.12: install_package> python -I -m pip install --force-reinstall --no-deps /home/acoghlan/devel/venvstacks/.tox/.tmp/package/975/venvstacks-0.1.0rc1-py3-none-any.whl
py3.12: commands[0]> pytest -m 'not slow' tests/
================================================= test session starts ==================================================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
cachedir: .tox/py3.12/.pytest_cache
rootdir: /home/acoghlan/devel/venvstacks
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, subtests-0.13.1
collected 116 items / 2 deselected / 114 selected

tests/test_basics.py ...                                                                                         [  2%]
tests/test_cli_invocation.py ...........................................................................         [ 68%]
tests/test_hashing.py ................                                                                           [ 82%]
tests/test_index_config.py ......                                                                                [ 87%]
tests/test_minimal_project.py .........                                                                          [ 95%]
tests/test_sample_project.py .....                                                                               [100%]

========================================== 114 passed, 2 deselected in 1.85s ===========================================
py3.13: remove tox env folder /home/acoghlan/devel/venvstacks/.tox/py3.13
py3.12: OK ✔ in 11.44 seconds
py3.13: install_deps> pdm sync --no-self --group dev
py3.13: install_package> python -I -m pip install --force-reinstall --no-deps /home/acoghlan/devel/venvstacks/.tox/.tmp/package/976/venvstacks-0.1.0rc1-py3-none-any.whl
py3.13: commands[0]> pytest -m 'not slow' tests/
================================================= test session starts ==================================================
platform linux -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0
cachedir: .tox/py3.13/.pytest_cache
rootdir: /home/acoghlan/devel/venvstacks
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, subtests-0.13.1
collected 116 items / 2 deselected / 114 selected

tests/test_basics.py ...                                                                                         [  2%]
tests/test_cli_invocation.py ...........................................................................         [ 68%]
tests/test_hashing.py ................                                                                           [ 82%]
tests/test_index_config.py ......                                                                                [ 87%]
tests/test_minimal_project.py .........                                                                          [ 95%]
tests/test_sample_project.py .....                                                                               [100%]

========================================== 114 passed, 2 deselected in 1.95s ===========================================
.pkg: _exit> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True pdm.backend
  py3.11: OK (12.53=setup[10.75]+cmd[1.77] seconds)
  py3.12: OK (11.44=setup[9.30]+cmd[2.14] seconds)
  py3.13: OK (11.71=setup[9.47]+cmd[2.24] seconds)
  congratulations :) (35.75 seconds)

@ncoghlan ncoghlan added the BLOCKED Progress is blocked by an external dependency label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKED Progress is blocked by an external dependency Category: Maintainability Proposed improvement to project maintainability CI (Automation) Continuous integration (and other automation)
Projects
None yet
Development

No branches or pull requests

1 participant