Skip to content

Enable UP rules in ruff config#770

Merged
bdraco merged 4 commits into
aio-libs:masterfrom
aiolibsbot:koan/fix-issue-769
May 19, 2026
Merged

Enable UP rules in ruff config#770
bdraco merged 4 commits into
aio-libs:masterfrom
aiolibsbot:koan/fix-issue-769

Conversation

@aiolibsbot
Copy link
Copy Markdown
Contributor

@aiolibsbot aiolibsbot commented May 18, 2026

What do these changes do?

Enable the pyupgrade (UP) rule set in the ruff lint
configuration and apply the resulting fixes across the
frozenlist stub and the in-tree PEP 517 build backend, now
that Python 3.9 support has been dropped in #766.

Type annotations are migrated to PEP 585 builtin generics
(list, dict, tuple) and PEP 604 union syntax (X | Y,
X | None); imports of Iterable, Iterator, Mapping,
MutableSequence, and Sequence are moved from typing to
collections.abc.

Are there changes in behavior for the user?

No. This is a contributor-facing lint configuration change.
The public API in frozenlist/__init__.pyi is equivalent under
PEP 585/604 (still resolvable in Python 3.10+).

Related issue number

Fixes #769

Checklist

  • I think the code is well written
  • Unit tests for the changes exist — N/A; lint-only change verified by ruff check
  • Documentation reflects the changes — N/A; no user-facing docs to update
  • If you provide code modifications, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES folder
Agent run details (optional, for reviewers)

Lint: ruff check . && ruff format --check . — all checks passed, 13 files already formatted.

Tests: pytest tests/ -q against the pure-Python implementation (FROZENLIST_NO_EXTENSIONS=1) — 110 passed. The Cython extension was not built in this sandbox (missing Python development headers), but the changes do not touch frozenlist/__init__.py or frozenlist/_frozenlist.pyx; they are confined to the .pyi stub and the PEP 517 build backend.

Drafted with Kōan + Claude Opus 4.7; reviewed by @bdraco.


Quality Report

Changes: 9 files changed, 26 insertions(+), 24 deletions(-)

Code scan: clean

Tests: failed (FAILED)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Adds the pyupgrade (UP) rule set to the ruff lint configuration in
pyproject.toml and applies the resulting fixes across the
`frozenlist` stub and the in-tree PEP 517 build backend.

Type annotations are migrated to PEP 585 builtin generics
(`list`, `dict`, `tuple`) and PEP 604 union syntax (`X | Y`,
`X | None`); imports of `Iterable`, `Iterator`, `Mapping`,
`MutableSequence`, and `Sequence` are moved from `typing` to
`collections.abc` to match the minimum supported Python version
(3.10+).

Refs aio-libs#769
Comment thread CHANGES/769.contrib.rst
@bdraco
Copy link
Copy Markdown
Member

bdraco commented May 18, 2026

../CHANGES.rst:121: : Spell check: pyupgrade: (pyupgrade) rule set in the .

This needs to be added to the spelling list

@bdraco
Copy link
Copy Markdown
Member

bdraco commented May 18, 2026

@aiolibsbot rr

@aiolibsbot
Copy link
Copy Markdown
Contributor Author

PR Review — Enable UP rules in ruff config

The mechanical pyupgrade migration itself is clean: typing-module aliases moved to collections.abc and PEP 585/604 syntax applied uniformly across the stub and the in-tree build backend, and the UP ruleset addition to pyproject.toml is well-commented. Two things are blocking merge readiness, both flagged by @bdraco: the news fragment attributes the change to the bot account (aiolibsbot) instead of the human operator (bdraco), and pyupgrade needs to be added to docs/spelling_wordlist.txt so the docs spellcheck job passes (this is what the FAILED status in the quality report is reporting). Neither is a code-correctness issue; both are project-convention fixes that should land in this same PR before flipping out of draft.


🟡 Important

1. Attribution should track the human operator, not the bot account (`CHANGES/769.contrib.rst`, L5)

Per project convention, the -- by :user:\...`attribution credits the human reviewer/operator, not the agent's bot account. This should be-- by :user:`bdraco`.` (matching the pattern used in the rest of the CHANGES tree where humans, not their automation, get the byline). This also aligns with what @bdraco is asking for in the inline suggestion at line 5.

-- by :user:`aiolibsbot`.
2. Add `pyupgrade` to the spelling wordlist

The docs spellcheck (make doc-spelling) is failing on the news fragment because pyupgrade is not a known word — this is what @bdraco flagged in the issue comment, and it lines up with the FAILED status in the quality report. AGENTS.md is explicit that the right fix is to extend docs/spelling_wordlist.txt with the legitimate new term rather than disabling the check or rephrasing around it. Add a pyupgrade entry (alphabetically placed) to that file in this PR so the spellcheck job goes green.

🟢 Suggestions

1. Symlink target depends on the guessed PR number being correct (`CHANGES/770.contrib.rst`, L1)

The 770.contrib.rst -> 769.contrib.rst symlink follows the AGENTS.md "both issue and PR number in play" pattern, which is good. Just confirm the actual PR number once GitHub assigns it; if the PR ended up as something other than #770, the symlink filename needs renaming so towncrier's cross-reference resolves to the right PR (the issue-numbered fragment stays as the real file either way).


Checklist

  • No hardcoded secrets or unsafe deserialization
  • Error handling untouched / no new resource leaks
  • Type annotations remain equivalent under PEP 585/604 on Python 3.10+
  • News fragment follows project conventions (attribution, naming) — warning #1
  • Docs spellcheck passes for newly-introduced terminology — warning #2
  • Pure-Python and Cython implementations kept in lockstep (N/A — .pyi stub only)
  • PR template followed; agent disclosure in collapsed footer; no Co-Authored-By trailers

Summary

The mechanical pyupgrade migration itself is clean: typing-module aliases moved to collections.abc and PEP 585/604 syntax applied uniformly across the stub and the in-tree build backend, and the UP ruleset addition to pyproject.toml is well-commented. Two things are blocking merge readiness, both flagged by @bdraco: the news fragment attributes the change to the bot account (aiolibsbot) instead of the human operator (bdraco), and pyupgrade needs to be added to docs/spelling_wordlist.txt so the docs spellcheck job passes (this is what the FAILED status in the quality report is reporting). Neither is a code-correctness issue; both are project-convention fixes that should land in this same PR before flipping out of draft.


To rebase addressing only specific severity levels, use: /rebase <url> critical (only 🔴), /rebase <url> important (🔴 + 🟡), or just /rebase <url> for all.


Automated review by Kōan7211b81
231e268
e1ef64c

@aiolibsbot
Copy link
Copy Markdown
Contributor Author

@bdraco: ../CHANGES.rst:121: : Spell check: pyupgrade: (pyupgrade) rule set in the .

Good catch — the docs spellcheck (make doc-spelling) doesn't know pyupgrade yet, which is also what's surfacing as the FAILED test status on this PR. Per AGENTS.md, the right fix is to extend docs/spelling_wordlist.txt with the legitimate new term rather than rewording around it. I'll add a pyupgrade entry (alphabetically placed) to that file in this branch so the spellcheck job goes green, and verify locally with make doc-spelling before pushing.

@aiolibsbot
Copy link
Copy Markdown
Contributor Author

Rebase with requested adjustments

Branch koan/fix-issue-769 was rebased onto master and review feedback was applied.

Changes applied

  • Changes applied:
  • CHANGES/769.contrib.rst: Changed byline from :user:\aiolibsbot`to:user:`bdraco`` per @bdraco's inline suggestion. Attribution credits human operator, not bot account.
  • docs/spelling_wordlist.txt: Added pyupgrade entry (alphabetically between Pytest and Quickstart) per @bdraco's comment about docs spellcheck failing on the news fragment.

Stats

10 files changed, 27 insertions(+), 24 deletions(-)
Actions performed
  • Already-solved check: negative (confidence=high, reasoning=No commit on master enables UP rules in ruff config or migrates type annotations to PEP 585/604 synt)
  • Rebased koan/fix-issue-769 onto upstream/master
  • Applied review feedback
  • Pre-push CI check: previous run #26063955153 failed
  • Pre-push CI fix: no changes needed or Claude found nothing to fix
  • Force-pushed koan/fix-issue-769 to origin
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Kōan

@bdraco bdraco marked this pull request as ready for review May 19, 2026 17:23
@bdraco bdraco merged commit 0726dc8 into aio-libs:master May 19, 2026
102 of 105 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable UP rules in RUFF now that we have dropped python 3.9 support

2 participants