Skip to content

MNT: replace fragile auto-update script with uv remove/uv add routine - #19380

Merged
neutrinoceros merged 2 commits into
astropy:mainfrom
neutrinoceros:dep/iers-data-upgrader
Mar 13, 2026
Merged

neutrinoceros merged 2 commits into
astropy:mainfrom
neutrinoceros:dep/iers-data-upgrader

Conversation

@neutrinoceros

Copy link
Copy Markdown
Contributor

Description

I wanted to improve this script's stability, using a proper dependency manager instead of manual str manipulation, and found that uv remove + uv add was a simple way to achieve the same effect, so the script can be removed altogether.

At the time of opening there's a small catch however: the remove/add routine doesn't seem to preserve comments from nearby lines (specifically, around pyerfa's requirement). It shouldn't be much of an issue, since this one comment is temporary anyway and probably should have it's how ticket. It is likely a bug in the rust toml library used by uv.

  • 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 Mar 9, 2026
@github-actions

github-actions Bot commented Mar 9, 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 dep/iers-data-upgrader branch from 66163b0 to b0335a4 Compare March 9, 2026 13:36
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I should note explicitly here that I'm blocking this on #19022

@pllim

pllim commented Mar 10, 2026

Copy link
Copy Markdown
Member

#19022 is merged. Please rebase. Thanks.

@neutrinoceros
neutrinoceros force-pushed the dep/iers-data-upgrader branch from 647e770 to b98da42 Compare March 10, 2026 17:13
@neutrinoceros
neutrinoceros marked this pull request as ready for review March 10, 2026 17:13
@neutrinoceros
neutrinoceros force-pushed the dep/iers-data-upgrader branch from b98da42 to b11c872 Compare March 10, 2026 21:21
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

@pllim is there anyone in particular we might want to ask for review ? merging this before the next run of this workflow would minimize friction

@pllim
pllim requested a review from astrofrog March 12, 2026 14:50
@pllim

pllim commented Mar 12, 2026

Copy link
Copy Markdown
Member

Tom R hopefully

- run: |
uv remove astropy-iers-data --no-sync
uv add astropy-iers-data --no-sync
uv run scripts/check-lowest-resolved-tree.py --overwrite

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 might be missing something, but how does this update the minimum pin in pyproject.toml?

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.

yes. But to be clear, it's not this exact line that does it. I'm taking advantage of the fact that uv adding a (new) dependency without an explicit lower bound automatically sets one at the current latest version. uv remove is called right before that to simulate astropy-iers-data being a "new" dependency, as far as uv add is concerned.

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.

Ok if this is the case, please be sure to add a comment about this. Also to be clear, are we sure this is not actually more fragile than before? Does uv add guarantee that it will always set the lower bound automatically? (or is there a flag we can use to explicitly opt in in case they ever change the defaults?)

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.

I'll add a comment.

Does uv add guarantee that it will always set the lower bound automatically?

yes:

in short: dependencies without lower bounds tend to trigger warnings in uv's installer when env resolution is set to lowest or lowest-direct, so there's a strong incentive for its devs to preserve this behavior for the sake of consistency, if nothing else.
Additionally, changing this behavior would be much more dirsuptive than most (if not all) of the breaking changes they've allowed thusfar, so I'm not worried.

is there a flag we can use to explicitly opt in in case they ever change the defaults?

The default behavior corresponds to --bounds lower, but as explained, I'd be less worried about astral changing the default behavior, and more about giving the impression, to anyone who'll read these lines in the future, that passing this argument is necessary.
I can do it and ensure my comment mentions how it's just hard-coding a default behavior, if you like.

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.

Yes I think just making it explicit and commenting that it's not really needed but just a safeguard against future changes would be ideal

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.

done

@neutrinoceros
neutrinoceros force-pushed the dep/iers-data-upgrader branch from b11c872 to 9cbad42 Compare March 13, 2026 10:33

@astrofrog astrofrog 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.

MInor nit, but looks good. Once you apply the suggestion feel free to merge

@neutrinoceros
neutrinoceros enabled auto-merge (squash) March 13, 2026 11:03
@neutrinoceros
neutrinoceros merged commit 30d48ad into astropy:main Mar 13, 2026
34 of 35 checks passed
@neutrinoceros
neutrinoceros deleted the dep/iers-data-upgrader branch March 13, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants