-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update uv_build version automatically #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
woodruffw
merged 11 commits into
pypa:main
from
konstin:konsti/update-uv-build-version-automatically
Sep 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8290c3f
Update uv_build version automatically
konstin a23f1a2
Update scripts/update_uv_build_version.py
konstin 7500df2
Review
konstin 77d8c71
Use same `actions/checkout@v4` as zizmor job
konstin 7df08f4
Linters
konstin 6497762
Undo accidental cosmetic change
konstin 31d7277
Update .github/workflows/update-uv-build-version.yml
konstin ce4251e
Create PR as draft
konstin bceb264
ci: remove workflow_dispatch from cron.yml
woodruffw c7ffbcc
ci: add pull_request event subtypes
woodruffw b036f24
update_uv_build_version: remove unneeded format
woodruffw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # /// script | ||
| # requires-python = ">=3.12" | ||
konstin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # dependencies = [ | ||
| # "httpx>=0.28.1,<0.29", | ||
| # "packaging>=25.0", | ||
webknjaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # ] | ||
| # /// | ||
| import re | ||
| from pathlib import Path | ||
|
|
||
| import httpx | ||
| from packaging.utils import parse_wheel_filename | ||
| from packaging.version import Version | ||
|
|
||
|
|
||
| def main(): | ||
| response = httpx.get( | ||
| "https://pypi.org/simple/uv-build/", | ||
| headers={"Accept": "application/vnd.pypi.simple.v1+json"}, | ||
| ) | ||
| response.raise_for_status() | ||
| data = response.json() | ||
| current_release = None | ||
| for file in data["files"]: | ||
| if not file["filename"].endswith(".whl"): | ||
| continue | ||
| _name, version, _build, _tags = parse_wheel_filename(file["filename"]) | ||
| if version.is_prerelease: | ||
| continue | ||
| if current_release is None or version > current_release: | ||
| current_release = version | ||
|
|
||
| [major, minor, _patch] = current_release.release | ||
| if major != 0: | ||
| raise NotImplementedError("The script needs to be updated for uv 1.x") | ||
| upper_bound = Version(f"{major}.{minor + 1}.{0}") | ||
woodruffw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| repository_root = Path(__file__).parent.parent | ||
| existing = repository_root.joinpath("source/shared/build-backend-tabs.rst").read_text() | ||
| replacement = f'requires = ["uv_build >= {current_release}, <{upper_bound}"]' | ||
| searcher = re.compile(re.escape('requires = ["uv_build') + ".*" + re.escape('"]')) | ||
| if not searcher.search(existing): | ||
| raise RuntimeError("Could not `uv-build` entry") | ||
| updated = searcher.sub(replacement, existing) | ||
|
|
||
| if existing != updated: | ||
| print("Updating source/shared/build-backend-tabs.rst") | ||
| Path("source/shared/build-backend-tabs.rst").write_text(updated) | ||
| print(f"::set-output name=version::{current_release}") | ||
woodruffw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| print(f"::set-output name=updated::true") | ||
| else: | ||
| print("Already up-to-date source/shared/build-backend-tabs.rst") | ||
| print(f"::set-output name=updated::false") | ||
|
|
||
| if __name__ == '__main__': | ||
| main() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.