Skip to content

Commit d74bca7

Browse files
ci: finish uv migration and preserve release version bumps
2 parents 49df755 + ed6535d commit d74bca7

483 files changed

Lines changed: 30690 additions & 4910 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/dependabot.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ updates:
1313
patterns:
1414
- "*"
1515

16-
- package-ecosystem: "pip"
16+
- package-ecosystem: "uv"
1717
directory: "/"
1818
schedule:
1919
interval: "weekly"

‎.github/scripts/bump_version.py‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"""Set a release version without installing dependencies or changing their locked versions."""
2+
3+
from __future__ import annotations
4+
5+
import argparse
6+
import re
7+
import subprocess
8+
from pathlib import Path
9+
10+
11+
def bump_version(root: Path, version: str) -> None:
12+
paths = [root / "pyproject.toml", root / "uv.lock", root / "aws_lambda_powertools/shared/version.py"]
13+
originals = {path: path.read_bytes() for path in paths}
14+
version_file = paths[-1]
15+
current = subprocess.check_output(["uv", "version", "--short"], cwd=root, text=True).strip()
16+
source = version_file.read_text()
17+
updated, count = re.subn(
18+
rf'^VERSION = "{re.escape(current)}"$',
19+
f'VERSION = "{version}"',
20+
source,
21+
flags=re.MULTILINE,
22+
)
23+
if count != 1:
24+
raise ValueError("The package version and shared/version.py must match before releasing")
25+
lock_file = paths[1]
26+
updated_lock, count = re.subn(
27+
rf'(?m)^(name = "aws-lambda-powertools"\nversion = "){re.escape(current)}'
28+
r'("\nsource = \{ editable = "\." \})$',
29+
rf"\g<1>{version}\g<2>",
30+
lock_file.read_text(),
31+
)
32+
if count != 1:
33+
raise ValueError("The lockfile must contain the current local package version")
34+
35+
# Fail before editing if the lockfile needs dependency changes.
36+
subprocess.run(["uv", "lock", "--check", "--offline"], cwd=root, check=True)
37+
try:
38+
# Avoid re-resolving dependencies, including on release runners with an empty cache.
39+
subprocess.run(["uv", "version", version, "--frozen"], cwd=root, check=True)
40+
lock_file.write_text(updated_lock)
41+
version_file.write_text(updated)
42+
subprocess.run(["uv", "lock", "--check", "--offline"], cwd=root, check=True)
43+
except (OSError, subprocess.CalledProcessError):
44+
for path, content in originals.items():
45+
path.write_bytes(content)
46+
raise
47+
48+
49+
def main() -> None:
50+
parser = argparse.ArgumentParser(description=__doc__)
51+
parser.add_argument("version", help="Release version, e.g. 3.36.0 or 3.36.0a0")
52+
parser.add_argument("--pre-release", action="store_true", help="Require an alpha, beta, or release candidate")
53+
args = parser.parse_args()
54+
number = r"(?:0|[1-9][0-9]*)"
55+
match = re.fullmatch(rf"{number}\.{number}\.{number}(?P<pre>(?:a|b|rc){number})?", args.version)
56+
if match is None or (args.pre_release and not match.group("pre")):
57+
parser.error("Use a version such as 3.36.0, 3.36.0a0, 3.36.0b1, or 3.36.0rc1; --pre-release requires a suffix")
58+
bump_version(Path(__file__).resolve().parents[2], args.version)
59+
60+
61+
if __name__ == "__main__":
62+
main()

‎.github/scripts/comment_on_large_pr.js‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

‎.github/scripts/download_pr_artifact.js‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎.github/scripts/enforce_acknowledgment.js‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎.github/scripts/label_missing_acknowledgement_section.js‎

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎.github/scripts/label_missing_related_issue.js‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎.github/scripts/label_pr_based_on_title.js‎

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)