Skip to content

TST: exclude packages newer than a week old from resolution - #19527

Merged
neutrinoceros merged 2 commits into
astropy:mainfrom
neutrinoceros:tst/exclude-newer
Jun 9, 2026
Merged

neutrinoceros merged 2 commits into
astropy:mainfrom
neutrinoceros:tst/exclude-newer

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Only allow packages to get in regular CI jobs after a cooldown period of a week, which should be more than enough time for upstream to address breaches in the style of llmlite.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@neutrinoceros neutrinoceros added this to the v8.0.0 milestone Apr 2, 2026
@neutrinoceros neutrinoceros added testing dependencies Pull requests that update a dependency file labels Apr 2, 2026
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@neutrinoceros
neutrinoceros force-pushed the tst/exclude-newer branch 2 times, most recently from bed8010 to 7148caa Compare April 2, 2026 13:03
@neutrinoceros neutrinoceros added the Extra CI Run cron CI as part of PR label Apr 2, 2026
@neutrinoceros
neutrinoceros marked this pull request as ready for review April 2, 2026 14:28
@neutrinoceros
neutrinoceros marked this pull request as draft April 2, 2026 15:15
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Apparently the env var isn't overriding the static config properly. This issue seems specific to tox though, and I was able to confirm that uv behaves correctly on its own.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

will report to tox-uv later today or tomorrow.

@neutrinoceros neutrinoceros added the Upstream Action Required Was: Upstream Fix Required label Apr 2, 2026
@neutrinoceros

neutrinoceros commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor Author

So, I tried (but failed) to reproduce the problem in a minimal project

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 is almost a year old but 6.1.2 was published a couple days ago
    "inifix>=6.1.1",
]

[tool.uv]
exclude-newer = "1 week"

tox.ini

[tox]
envlist =
    py314,-pre
requires =
    tox-uv

[testenv]
setenv =
    pre: UV_EXCLUDE_NEWER = 0day # allow latest versions with no cooldown period. Also a security pun.
commands =
    {list_dependencies_command}

abridged logs

❯ tox -e py314-pre             
(...)
py314-pre: commands[0]> .tox/.tox/bin/uv --color never pip freeze
Using Python 3.14.3 environment at: .tox/py314-pre
inifix==6.1.2
test @ file:///private/tmp/test/.tox/.tmp/package/1/test-0.1.0.tar.gz
  py314-pre: OK (2.32=setup[2.31]+cmd[0.01] seconds)
  congratulations :) (2.34 seconds)

I got inifix 6.1.2, proving that everything is behaving as I'd expect. This means that the issue I ran into only shows up in a more complex scenario, and might still be a bug in uv. I'll try to refine this later.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

some progress on this: it looks like tox isn't invalidating its own cache on edits to tox.ini (at least not all of them. I'll still assume it behaves as expected if I change deps, extras or dependency_groups settings). Now the question becomes: are we caching tox envs in CI ?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

yes we are: #18835 (I forgot the specifics of this PR)

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

except... that's not the whole story yet. The failing job is running on Circle CI, whose config wasn't updated in #18835

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

... and I don't think we're caching any dependency on this service.
To be specific, we're not using save_cache

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

(still, I reported tox-dev/tox#3917 to clear the air)

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Keeping an eye out for astral-sh/uv#18839

@neutrinoceros
neutrinoceros force-pushed the tst/exclude-newer branch 4 times, most recently from 97f7ee2 to 5ad8cf4 Compare April 10, 2026 06:56
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

This is working as expected now. I would have prefered defining a global exclude-newer in [tool.uv] and overriding it with anv env var in select tox envs but this approach didn't work so this will do for now

@neutrinoceros
neutrinoceros marked this pull request as ready for review April 10, 2026 07:27
Comment thread tox.ini Outdated
clocale: LC_ALL = C
devdeps: UV_INDEX = https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
mpldev: UV_INDEX = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
!devdeps-!mpldev-!predeps-!devpytest: UV_EXCLUDE_NEWER = 1 week

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about

  • the dash on LHS, and
  • the whitespace in "1 week"

How do we know it is working?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dash on LHS

I picked it up from somewhere else on our tox.ini

the whitespace in "1 week"

I checked earlier that this works as expected but I could also spell it as "1week", or "P1W", or "P7D". Any preference ?

How do we know it is working?

We could insert a uv tree --all-groups --outdated in the test commands. This would highlight any installed package that is not at current latest version. Just seeing that there are some is a strong indication that this works as intended, but you could also scrutinize some more and check how old each skipped latest version actually is...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dash vs comma: In this section (setenv), I only see commas being used on main. Is there a difference?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"1week", or "P1W", or "P7D". Any preference ?

I prefer something that is officially documented, which I cannot find in the sparse description of https://docs.astral.sh/uv/reference/environment/#uv_exclude_newer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples have quotes but the diff does not... 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be the difference between TOML (used in uv's docs) and tox.ini

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dash vs comma: In this section (setenv), I only see commas being used on main. Is there a difference?

there's an example of this in commands: !cov-!double:
And empirically, IIRC, the difference is that, if I remove the dash, tox just ignores my setting entirely

@pllim

pllim commented Apr 30, 2026

Copy link
Copy Markdown
Member

If we ignore the cooldown for devdeps anyway, what are we really guarding against here?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Malicious releases installing on any other job.

@pllim

pllim commented Apr 30, 2026

Copy link
Copy Markdown
Member

But if it is malicious and already have access to devdeps job, does it matter?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

It's still incremental progress. I can tighten the screw some more later on by defining a whitelist of trusted packages (numpy, scipy, matplotlib ...) that we actually want to use nightlies of, which will remove the risk from other (direct or otherwise) dependencies.

@pllim

pllim commented Apr 30, 2026

Copy link
Copy Markdown
Member

tighten the screw some more later

Should that be part of this PR?

@astrofrog astrofrog modified the milestones: v8.0.0, v8.1.0 May 5, 2026

@nstarman nstarman left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is sensible. It should reduce noise from buggy new releases but is still much less than our release timescale, so we should see all incoming changes.
I didn't know this was a thing and now I need to go update a bajillion of my own packages.
I'm approving on the idea alone. I'm happy for @pllim and infra team maintainers to make the actual final decision.

@pllim

pllim commented May 14, 2026

Copy link
Copy Markdown
Member

There is an "upstream action required" label. Is this blocked by something else?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Should that be part of this PR?

My hope was to get this one merged quickly so we'd get half the benefit immediately. As it stands I would still prefer to defer the fine tuning to a follow PR.

There is an "upstream action required" label. Is this blocked by something else?

Sorry for dropping the ball here. I should have linked to my upstream report:
tox-dev/tox#3917
It's actually been fixed in tox-uv 1.35

@neutrinoceros neutrinoceros removed the Upstream Action Required Was: Upstream Fix Required label Jun 9, 2026
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Given @nstarman's approval and since there's nothing blocking now, I'll merge this and will open a follow up PR to tentatively refine tuning on devdeps.

@neutrinoceros
neutrinoceros enabled auto-merge June 9, 2026 08:47
@neutrinoceros
neutrinoceros merged commit 238943c into astropy:main Jun 9, 2026
41 of 45 checks passed
@neutrinoceros
neutrinoceros deleted the tst/exclude-newer branch June 9, 2026 09:49
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

follow up: while there are options to create a white list of packages as I suggested earlier, I think I'm seeing a better solution and proposed it upstream astral-sh/uv#19749

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

turns out the feature I proposed already exists: 🤦🏻‍♂️ + 🎉

the follow up PR is at #19886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file Extra CI Run cron CI as part of PR no-changelog-entry-needed testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants