Skip to content

tox-uv fails to recreate or sync repo when an uv constraint is added #258

@ssbarnea

Description

@ssbarnea

Issue

In order to help uv install the right packages I had to add some constraints like below

# pyproject.toml
[tool.uv]
constraint-dependencies = [
  "ansible-core>=2.20.0.dev0; python_version >= '3.14'",
]

After this I run uv lock in order to update the lock file.

The problem came when I run tox again and it just run without recreating the environment, despite having the pyproject.toml and uv.lock file modified since the last run.

Running with -r did address the issue, but I filed it so we can track its occurence and find a way to improve the behavior.

Note that the dependencies themselves were not modified, but that this not "enough" to determine if a sync should happen.

In fact due to how fast sync is, I would even wonder if the fix would not just be to always run uv sync.

The problem is more serious than it would initially appear because it can also happen on CI if user is deciding to cache tox environments.

Details

ROOT: will run in automatically provisioned tox, host /Users/ssbarnea/.venv/bin/python3 is missing [requires (has)]: tox-extra>=2.0.1
ROOT: provision> .tox/.tox/bin/python -m tox -e py -- -k test_lint_collection --pdb -s
.pkg: _optional_hooks> python /Users/ssbarnea/code/a/devtools/ansible-creator/.tox/.tox/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /Users/ssbarnea/code/a/devtools/ansible-creator/.tox/.tox/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_editable> python /Users/ssbarnea/code/a/devtools/ansible-creator/.tox/.tox/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py: install_package> .tox/.tox/bin/uv pip install --reinstall --no-deps ansible-creator@/Users/ssbarnea/code/a/devtools/ansible-creator/.tox/.tmp/package/89/ansible_creator-25.9.1.dev18-0.editable-py3-none-any.whl
py: commands_pre[0]>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions