Skip to content

PYTHON-5980 Handle exclude-newer in the uv lock update action - #118

Merged
blink1073 merged 3 commits into
mongodb-labs:mainfrom
blink1073:PYTHON-5980-exclude-newer
Aug 14, 2026
Merged

PYTHON-5980 Handle exclude-newer in the uv lock update action#118
blink1073 merged 3 commits into
mongodb-labs:mainfrom
blink1073:PYTHON-5980-exclude-newer

Conversation

@blink1073

@blink1073 blink1073 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

Adds a 7 day cutoff on new releases in the uv lock update action, overridable through an exclude_newer input.

Motivation

Prior to this change, a scheduled update would include every release the moment it lands, including one yanked hours later as broken or compromised. A week of distance means a bad release is usually withdrawn first.

Changes

  • exclude_newer input, defaulting to 7 days and reaching uv as UV_EXCLUDE_NEWER. It takes anything uv's --exclude-newer does: a date, an RFC 3339 timestamp, a duration such as 30 days, or false to disable the cutoff.
  • An empty input leaves UV_EXCLUDE_NEWER unset, so a repository can keep the cutoff in its own uv configuration. uv rejects the variable when it is set but empty, so this case has to be handled rather than passed through.

Testing

Ran the resulting step against uv 0.12 both ways: 7 days locks with exclude-newer-span = "P7D", and an empty value locks with no cutoff recorded.

@blink1073
blink1073 force-pushed the PYTHON-5980-exclude-newer branch from 371185f to fc1ee44 Compare August 14, 2026 10:38
@blink1073
blink1073 requested a review from aclark4life August 14, 2026 10:42
@blink1073
blink1073 marked this pull request as ready for review August 14, 2026 10:42
@aclark4life
aclark4life requested a lite review from Copilot August 14, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the python/uv-lock-update composite action to apply a default “exclude newer than 7 days” cutoff for uv lock --upgrade, with an exclude_newer input to override or disable that behavior, reducing the chance of immediately locking to freshly-published (and potentially yanked) releases.

Changes:

  • Added a new exclude_newer action input (default: 7 days) that is forwarded to uv via UV_EXCLUDE_NEWER.
  • Implemented logic to not set UV_EXCLUDE_NEWER when the input is empty (since uv rejects an empty-but-set value).
  • Updated README documentation to describe the new default cutoff and configuration options.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
README.md Documents the new 7-day cutoff behavior and the exclude_newer override semantics.
python/uv-lock-update/action.yml Adds the exclude_newer input and conditionally exports UV_EXCLUDE_NEWER before running uv lock --upgrade.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md
Comment thread python/uv-lock-update/action.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

python/uv-lock-update/action.yml:79

  • When exclude_newer is explicitly empty, this branch does not remove an inherited UV_EXCLUDE_NEWER from the caller's job/workflow environment. uv will still use that inherited cutoff instead of the repository's pyproject.toml/uv.toml setting, contradicting the documented empty-input behavior. Explicitly unset the variable in the empty branch.
        if [ -n "$EXCLUDE_NEWER" ]; then
          export UV_EXCLUDE_NEWER="$EXCLUDE_NEWER"
        fi

# rejects it when empty, so an empty input has to leave it unset rather
# than be passed through.
if [ -n "$EXCLUDE_NEWER" ]; then
export UV_EXCLUDE_NEWER="$EXCLUDE_NEWER"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does uv parse the string false as a date/timestamp/duration?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, false is a special value. uv's --exclude-newer help says "Use false to disable exclude-newer", and that applies to UV_EXCLUDE_NEWER as well.

I checked against uv 0.12: with [tool.uv] exclude-newer = "2024-01-01" in
pyproject.toml, UV_EXCLUDE_NEWER=false uv lock --upgrade resolves cleanly and
the resulting lock records no cutoff at all. A value uv cannot parse fails the
step instead, so a typo like flase errors out rather than quietly disabling the
cutoff.

@blink1073
blink1073 requested a review from aclark4life August 14, 2026 20:02

@aclark4life aclark4life left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@blink1073
blink1073 merged commit 2515c76 into mongodb-labs:main Aug 14, 2026
7 checks passed
@blink1073
blink1073 deleted the PYTHON-5980-exclude-newer branch August 14, 2026 21:05
blink1073 added a commit to blink1073/drivers-github-tools that referenced this pull request Aug 14, 2026
Conflict in README.md: mongodb-labs#118 documented the uv-lock-update action's new
exclude_newer input in the Python section that this branch moved into
python/README.md. Kept the split and ported mongodb-labs#118's wording into the moved
section, which now matches main's text exactly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants