Repository navigation
Description
Maybe this is working as expected, but it looks like a bug to me: I'm trying to set up a project with tox-uv such that
- unless explicitly specified via an env var,
uvignores packages released after a given date (here, specified as absolute for reproducibility) - some env factors do allow latest versions of everything
Here's the setup
pyproject.toml
[project]
name = "test"
version = "0.1.0"
requires-python = ">=3.14"
dependencies = [
# inifix is a tiny, 0-deps package of mine.
# 6.1.1: 2025-04-14
# 6.1.2: 2026-04-01
"inifix>=6.1.1",
]
[tool.uv]
exclude-newer = "2026-03-01" # should exclude inifix 6.1.1tox.ini
[tox]
envlist =
py314,-pre
requires =
tox-uv
[testenv]
setenv =
pre: UV_EXCLUDE_NEWER = 0day # allow latest versions
commands =
{list_dependencies_command}If I run uvx tox -e py314-pre without a cache, this works as expected (I get inifix==6.1.2). I'll call this the baseline run.
However, if I follow the following steps
rm -fr .tox || true
# comment out `setenv` settings from tox.ini
uvx tox -e py314-pre
# uncomment the setting
uvx tox -e py314-preThen I get inifix==6.1.1 on both run. It is the correct result for the first run, but not the second: the only difference between the second run here and the baseline run is the state of tox's chache, and it's causing results to differ. My conclusion is that the cache was erroneously validated when it shouldn't have; of course it's impractical for tox to guess exactly what changes should invalidate the cache, but I would expect one of the following:
-
any change to
tox.inishould invalidate the cache -
if
toxtries to be smart about it,tox-uvshould be able to extend the rules to invalidate any change in aUV_-prefixed env var. -
users should be able to customize cache keys in some way
-
would be my preference
I don't know how close 2) is from the current state of affairs (I couldn't locate the logic in tox's code), but depending on the situation it might be a bug in tox, in tox-uv, or both. -
is by far my least favorite option, because it doesn't resolve the core issue that the default behavior is incorrect.
Activity
🐛 fix(pip): invalidate install cache on resolution env var changes
🐛 fix(installer): invalidate install cache on resolution env var changes
🐛 fix(pip): invalidate install cache on resolution env var changes (#…