diff options
| author | salmonik <raisersoft@proton.me> | 2026-07-08 02:13:35 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-07-08 02:13:35 +0200 |
| commit | cd8ed8bc5793985df2c1692072a932ceee517b95 (patch) | |
| tree | 42d18a4140259b5c68b4dd05b7fcb398f78b8d7f /scripts | |
| parent | Merge pull request 'Voice related fixes, alongside simplifying assistant' (#5... (diff) | |
| download | senator-sperma-cd8ed8bc5793985df2c1692072a932ceee517b95.tar.gz senator-sperma-cd8ed8bc5793985df2c1692072a932ceee517b95.zip | |
OPEN THE RUST GATES
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
| -rw-r--r-- | scripts/bump_reqs.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/scripts/bump_reqs.py b/scripts/bump_reqs.py deleted file mode 100644 index 5d253e7..0000000 --- a/scripts/bump_reqs.py +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | """Bump all pinned versions in requirements*.txt to latest from PyPI.""" | ||
| 3 | |||
| 4 | import json | ||
| 5 | import re | ||
| 6 | import urllib.request | ||
| 7 | from pathlib import Path | ||
| 8 | |||
| 9 | REQS = sorted(Path().glob("requirements*.txt")) | ||
| 10 | PYPI = "https://pypi.org/pypi/{}/json" | ||
| 11 | |||
| 12 | |||
| 13 | def latest_version(package: str) -> str | None: | ||
| 14 | url = PYPI.format(package) | ||
| 15 | try: | ||
| 16 | with urllib.request.urlopen(url, timeout=10) as resp: | ||
| 17 | data = json.load(resp) | ||
| 18 | return data["info"]["version"] | ||
| 19 | except Exception: | ||
| 20 | return None | ||
| 21 | |||
| 22 | |||
| 23 | def bump_file(path: Path): | ||
| 24 | lines = path.read_text().splitlines() | ||
| 25 | changed = [] | ||
| 26 | for line in lines: | ||
| 27 | m = re.match(r"^([\w-]+(?:\[[\w-]+])?)==[\w.]+$", line) | ||
| 28 | if m: | ||
| 29 | pkg = m.group(1) | ||
| 30 | latest = latest_version(pkg) | ||
| 31 | if latest: | ||
| 32 | changed.append(f"{pkg}=={latest}") | ||
| 33 | if f"{pkg}=={latest}" != line: | ||
| 34 | print(f" {pkg}: {line.split('==')[1]} -> {latest}") | ||
| 35 | else: | ||
| 36 | changed.append(line) | ||
| 37 | print(f" {pkg}: failed to fetch, keeping current") | ||
| 38 | else: | ||
| 39 | changed.append(line) | ||
| 40 | path.write_text("\n".join(changed) + "\n") | ||
| 41 | |||
| 42 | |||
| 43 | def main(): | ||
| 44 | for req in REQS: | ||
| 45 | print(f"\n{req}:") | ||
| 46 | bump_file(req) | ||
| 47 | |||
| 48 | |||
| 49 | if __name__ == "__main__": | ||
| 50 | main() | ||
