1.4.0: Python 3.15, ruff 0.17.1 (#6)
Moves the bot, CI and release workflows from Python 3.14 to 3.15. `"3.15"` takes the newest 3.15.x the runner has: 3.15.0 from the image's tool cache today, 3.15.1 once the image updates. Also replaces the stuck Dependabot PR #4. - `ci.yml` (lint, test), `notify.yml`, `release.yml`: `python-version: "3.15"`. - `requirements-dev.txt`: ruff 0.16.5 → 0.17.1, which is 7 days old and so matches the Dependabot cooldown. pytest 9.1.1 is already the latest and declares 3.15. - `pyproject.toml`: ruff `target-version = "py315"`. pytest gets `filterwarnings = ["error"]`, so a deprecated stdlib call fails CI instead of breaking the bot on the next Python. - `scripts/youtube.py`: the only change ruff format makes for py315, `except ValueError, AttributeError:` (PEP 758). From here the code needs Python 3.14+. - `.sonarcloud.properties` (new): `sonar.python.version=3.15`. Without it, Sonar also analyses for Python 2, where that `except` means something else. The setting takes effect only once it is on `main`, so this PR's own Sonar run still uses the defaults. - README: local dev needs Python 3.15. When a Dependabot PR falls behind `main`, comment `@dependabot rebase` instead of clicking "Update branch", which rewrites the commit without a signature. - `changelog/1.x.md`: 1.4.0 entry, dated 2026-10-22. Fix the date if this merges later. ## Compatibility (measured on Python 3.15.1, 2026-10-22) - All 44 tests pass on 3.15.1 and on 3.14.7 with every warning as an error (`-X warn_default_encoding -W error`). - CI on this PR set up CPython 3.15.0: ruff is clean and all 44 tests pass with `filterwarnings = ["error"]`. - None of the APIs removed or changed in 3.15 are used: `sre_*`, `glob.glob0/glob1`, `PurePath.is_reserved`, `platform.java_ver`, `CGIHTTPRequestHandler`, `typing.no_type_check_decorator`, the `NamedTuple` keyword form, `load_module`, `locale.getdefaultlocale`, `strptime` without a year, `utcnow`. - Every text-mode `open`/`read_text`/`write_text` names an encoding. - Live GETs through `http_client` work on 3.15.1: the watch page, a ytimg thumbnail, the Bluesky PDS and Mastodon. - PEP 686 (UTF-8 mode by default) changes nothing on Linux CI. On Windows, `release_notes.py` piped to a file crashed with `UnicodeEncodeError` on 3.14 and works on 3.15. ## Dependabot - #4 is BLOCKED. On 2026-09-23 "Update branch" (rebase) rewrote its commit without a signature, and the `main` ruleset requires signed commits. Dependabot also stops updating a PR once a human has pushed to it. This PR carries the ruff bump instead, and #4 gets closed after the merge. - The `dependencies` label that `dependabot.yml` asks for did not exist. It is created alongside this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ceaa53757e
commit
878c3eb9a1
9 files changed
+37
-7
No files matched your search
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.14"
|
||||
python-version: "3.15"
|
||||
cache: pip
|
||||
cache-dependency-path: requirements-dev.txt
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.14"
|
||||
python-version: "3.15"
|
||||
cache: pip
|
||||
cache-dependency-path: requirements-dev.txt
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.14"
|
||||
python-version: "3.15"
|
||||
|
||||
- name: Run notification script
|
||||
env:
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.14"
|
||||
python-version: "3.15"
|
||||
|
||||
- name: Extract release notes from changelog
|
||||
env:
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# SonarQube Cloud automatic analysis settings. They take effect once this file
|
||||
# is on the default branch.
|
||||
# https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/automatic-analysis/
|
||||
|
||||
# The version every workflow sets up (actions/setup-python). Without it, Sonar
|
||||
# analyses the code as if it also had to run on Python 2, where `except A, B:`
|
||||
# (PEP 758, Python 3.14+) means something else.
|
||||
sonar.python.version=3.15
|
||||
@@ -142,6 +142,9 @@ Chạy local thì đặt `STATE_FILE` (mặc định `state/last_video.txt`, th
|
||||
|
||||
## 6. Phát triển
|
||||
|
||||
Cần **Python 3.15**, cùng bản với CI, bot và release. Code dùng cú pháp chỉ có từ 3.14
|
||||
(`except A, B:` không ngoặc), nên Python 3.13 trở xuống không chạy được.
|
||||
|
||||
```bash
|
||||
python -m pip install -r requirements-dev.txt
|
||||
ruff check . && ruff format --check .
|
||||
@@ -181,4 +184,8 @@ Ruleset `main` (không có bypass, kể cả admin): chỉ merge qua PR bằng *
|
||||
lịch sử tuyến tính, check `ci` phải xanh trên bản mới nhất của `main`, không force-push, không xoá.
|
||||
Ruleset `release-tags` bảo vệ tag `v*` khỏi xoá/ghi đè. Dependabot mở PR gộp mỗi thứ Hai.
|
||||
|
||||
PR của Dependabot bị tụt sau `main` (check `ci` phải chạy trên bản mới nhất) thì comment
|
||||
`@dependabot rebase` trong PR. **Đừng bấm Update branch**: GitHub rebase xong để lại commit không ký
|
||||
nên ruleset chặn merge, và khi đã có người push vào PR thì Dependabot thôi cập nhật nó.
|
||||
|
||||
Repo private cá nhân không có CodeQL; thay bằng ruff rule `S`, zizmor và actionlint trong CI.
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
Mới nhất ở trên. Quy ước ở [`README.md`](README.md).
|
||||
|
||||
## 1.4.0 — 2026-10-22
|
||||
|
||||
Chuyển lên Python 3.15. Bài đăng, lịch chạy và secret không đổi.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Python 3.15** cho bot, CI và release (trước là 3.14). Chạy script hoặc test ở máy cần Python
|
||||
3.15; code dùng cú pháp `except A, B:` của 3.14+, nên 3.13 trở xuống không chạy được.
|
||||
- Trên Windows, script in tiếng Việt ra pipe hoặc file không còn lỗi `UnicodeEncodeError`: Python
|
||||
3.15 mặc định bật UTF-8 mode (PEP 686).
|
||||
- Công cụ dev: ruff 0.17.1, kiểm theo cú pháp Python 3.15. Test coi mọi warning là lỗi, nên một API
|
||||
Python sắp gỡ làm CI đỏ trước khi kịp làm hỏng bot.
|
||||
|
||||
## 1.3.0 — 2026-09-02
|
||||
|
||||
### Removed
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
[tool.ruff]
|
||||
target-version = "py312"
|
||||
target-version = "py315"
|
||||
line-length = 100
|
||||
extend-exclude = ["state"]
|
||||
|
||||
@@ -25,3 +25,5 @@ known-first-party = [
|
||||
pythonpath = ["scripts"]
|
||||
testpaths = ["tests"]
|
||||
addopts = "-q"
|
||||
# A deprecated stdlib call fails CI here, not in production on the next Python.
|
||||
filterwarnings = ["error"]
|
||||
@@ -1,3 +1,3 @@
|
||||
# Development-only. The scripts themselves are stdlib-only.
|
||||
ruff==0.16.5
|
||||
ruff==0.17.1
|
||||
pytest==9.1.1
|
||||
+1
-1
@@ -77,7 +77,7 @@ def parse_timestamp(value: str) -> datetime | None:
|
||||
"""ISO 8601 → aware datetime (UTC assumed when no offset). None if unparsable."""
|
||||
try:
|
||||
dt = datetime.fromisoformat(value.strip())
|
||||
except (ValueError, AttributeError):
|
||||
except ValueError, AttributeError:
|
||||
return None
|
||||
return dt if dt.tzinfo else dt.replace(tzinfo=UTC)
|
||||
|
||||
|
||||
Reference in new issue
Block a user