TST: fine tune per-index cooldown periods - #19886
Conversation
|
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.
|
3740d3b to
b6545c2
Compare
|
Ah, this doesn't quite work as I thought. Configuring an index implies it's always included in resolution, which isn't what we want. |
|
This is now working as intended, with an extremely minor defect: it h5py's nightlies are currently preferred to stable releases. And that's just because it doesn't use dev version numbers (yet). All other nightly packages behave as you'd expect, so even with indexes permanently configured, we only get nightlies when preleases are enabled. |
4dce841 to
b67d9f9
Compare
25e2f6c to
0e0a0a2
Compare
|
h5py is now in line with other nightly-publishers, so there really nothing blocking this anymore ! |
0e0a0a2 to
9226dea
Compare
| # It is called "unsafe" because it allows dependency confusion-based attacks | ||
| # but we trust anaconda.org's nightly channels because they only serve a | ||
| # very limited set of packages that can't easily be expanded. | ||
| index-strategy = "unsafe-best-match" |
There was a problem hiding this comment.
I don't understand the full implication of moving this here rather than only for specific tox flags in tox.ini
There was a problem hiding this comment.
The implication is that uv will always match pip's resolution strategy and effectively merge all configured indexes in resolution, regardless if it's used through tox or not, and regardless of the tox environment considered. In practice this only makes a difference where pre-releases are allowed, because no index other than PyPI contains anything else than pre-releases.
There was a problem hiding this comment.
Does this answer your questions ?
There was a problem hiding this comment.
Mainly I want to know what kind of commands would now trigger this behavior because it is not longer jailed within devdeps directive in tox.ini . I don't use uv. Maybe someone more familiar with this toolset should review and approve. @astrofrog ?
There was a problem hiding this comment.
Any (non locked) uv based installation would use this, but it won't change anything without pre-releases allowed: this setting only matters when multiple indexes are used in resolution, and we're effectively enabling a single one (PyPI.org) when pre-releases are excluded (default).
|
beyond the cleanup aspect, it would useful for me (and other uv users) to get this in. It makes installing devdeps much easier from calling uv directly ( |
|
With the release of uv 0.12.0 this also simplifies testing CPython pre-prereleases, because e.g. numpy nightlies will be auto selected when no other binary is available. |
|
@astrofrog could we get this in soon ? |
|
@Andrej730, as a uv user, can I ask you for a review ? |
|
No idea how much any of the below is practically possible to be harmful, just tried to think through the edge cases of such change. Having As you mentioned, h5py is posting their release wheels to the nightly too (e.g. (you mentioned it as fixed, but apparently it's either regressed and starting posting non-dev builds again or I misunderstood your message) So there's a bit of risk involved because non-pre users start to depend on how well nightlies are maintained.
Had an idea that it can be worked around just by adding pypi index to the toml explicitly, that will make it first choice instead of being a default index (which in uv means a fallback) and will guard from duplicated releases from nightlies. [[tool.uv.index]]
name = "PyPI"
url = "https://pypi.org/simple"
One more thing to note that currently it will be checking all packages from nightly indexes. Unsure if some unexpected package might show up, but maybe its worth using |
|
Thanks a bunch !
Thanks for pointing it out. I was assuming the old wheels would be gone by now but they're not. Fortunately I have the key to this index and should be able to delete them manually :)
Interesting ! is that still true with
I'll need to look into it ! |
update: I just did |
If I'm understanding the docs correctly, this would actually completely disable nightly indexes until ref: https://docs.astral.sh/uv/concepts/indexes/#pinning-a-package-to-an-index |
To clarify - I meant e.g. if h5py 3.16 release is present on both PyPI and nightly, then it might get locked using nightly url and then nightly url might become dead and there will be an error during resync.
Yeah, can confirm it, I was testing with this PR + explicit PyPI index and it was preferring
Ahh, you're right, I thought it's possible to do
A bit harder to reproduce nightly index sneaking in now, haha. |
Oh, that's right. Fortunately h5py was the only rogue package in the entire index and the easiest one to fix for me, but I am explicitly assuming that this won't happen again, and if it does... well, lock files are human-readable and I hope we'll be collectively disciplined enough to leverage this feature and not commit such a change. |
9226dea to
bf53ca0
Compare
624915e to
1acde23
Compare
8b0ef0e to
07e6860
Compare
07e6860 to
bbd9ef4
Compare
|
Since @jdavies-st just stared into this UV rabbit hole elsewhere, I would appreciate extra pair of eyes if he has the time. Thanks, all! |
astrofrog
left a comment
There was a problem hiding this comment.
A few comments - I can review again shortly once you've had a chance to take a look!
| # exclude packages published less than a week ago (ISO 8601) | ||
| exclude-newer = "P7D" | ||
| # always allow arbitrarily new versions of astropy-iers-data | ||
| exclude-newer-package = { "astropy-iers-data" = false } |
There was a problem hiding this comment.
Is exclude-newer-package supported in [[tool.uv.index]]? If not, it should be kept at top/global level?
There was a problem hiding this comment.
technically it's in preview right now. Configuring it is enough to enable the feature, you just get a warning on every install for the time being. I do not anticipate any breaking change when it's stabilized, though for completeness it does mean participating to testing an 'unstable' feature.
There was a problem hiding this comment.
I'm now explicitly opting into this preview feature in tool.uv
| name = "pypi" | ||
| url = "https://pypi.org/simple" | ||
| # exclude packages published less than a week ago (ISO 8601) | ||
| exclude-newer = "P7D" |
There was a problem hiding this comment.
So to be clear, if there is a package released only say 2 days ago on PyPI, does it get excluded in favor of older packages on the nightly channels?
There was a problem hiding this comment.
Also is this going to cause issues for packages which have short RC periods like e.g. sphinx? (as in we might miss an RC phase altogether?)
There was a problem hiding this comment.
So to be clear, if there is a package released only say 2 days ago on PyPI, does it get excluded in favor of older packages on the nightly channels?
if pre-releases are enabled, yes.
Also is this going to cause issues for packages which have short RC periods like e.g. sphinx?
only for packages that have short rcs and nightlies, which as far as I know is an empty set. Even then, we'd get the nightly wheel instead of the rc, which should mean testing closer to the dev branch rather than further away from it
There was a problem hiding this comment.
But what about packages that don't have any nightlies? Would we ignore any release from the last 7 days?
There was a problem hiding this comment.
Ah, for these, yeah, but that's already what happens on main
|
|
||
| commands = | ||
| # docdeps-predeps: Override sphinx max pin in sphinx-design | ||
| docdeps-predeps: uv pip install sphinx -U --pre --no-deps |
There was a problem hiding this comment.
So does every -predeps factor now pick up dev wheels too? Is there a difference between -predeps and -devdeps anymore?
There was a problem hiding this comment.
predeps is still special in how it compounds with docdeps, though the remaining difference should tend towards 0 eventually.
There was a problem hiding this comment.
Is that desirable though? Predeps allow us to test RCs without necessarily testing more unstable dev versions? (As in it is normal for a dev test to fail sometimes whereas predeps failing indicates a real issue we have to act on)
There was a problem hiding this comment.
IMHO the difference isn't worth it, but we could in principle disable all indexes other than PyPI for predeps
There was a problem hiding this comment.
I personally think that would be preferable otherwise we might as well drop the name predeps?
There was a problem hiding this comment.
dropping predeps is on my radar for a follow up PR, so that's the trajectory I'm setting course for. I think it's fine either way but if we configure it further now then dropping it becomes unachievable so we might as well take a decision now.
There was a problem hiding this comment.
Whoa whoa... hold your horses. Dropping predeps was never discussed and I would have never agreed to it. There is a difference between testing combo of RCs and combo of nightly wheels. We didn't do it for fun; it is necessary.
There was a problem hiding this comment.
I just pushed an additional commit to resolve this, as well as #19886 (comment)
|
|
||
| setenv = | ||
| predeps: UV_INDEX_STRATEGY = unsafe-best-match # match pip's behavior | ||
|
|
There was a problem hiding this comment.
So does this pick up the setenv from the base job, or no setenv?
There was a problem hiding this comment.
it takes it from the base job
919994b to
662a302
Compare
662a302 to
2a8d83b
Compare
|
rebased, now explicitly opting in the |
|
@astrofrog I think all your requests were addressed. Let me know if there's anything else ! |
2a8d83b to
7935c2e
Compare
7935c2e to
131bc0b
Compare
| # requires-python = ">=3.11" | ||
| # dependencies = [ | ||
| # "uv==0.11.19", | ||
| # "uv==0.12.11", |
There was a problem hiding this comment.
forced pushed to include this upgrade, because uv 0.11 didn't support the preview-feature setting at all
Description
Follow up to #19527
Instead of whitelisting certain packages as I initially imagined, move the trust to the sp-python nightlies channel itself.