Skip to content

v5.3.0: StrEnum config enums, typing.Self, and the Python 3.11 floor - #226

Merged
ajslater merged 3 commits into
developfrom
py311-modernize
Oct 1, 2026
Merged

ajslater merged 3 commits into
developfrom
py311-modernize

Conversation

@ajslater

@ajslater ajslater commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Follow-up to 9637f39 (minimum Python is now 3.11): clears the remaining make fix errors and adopts the 3.11 features that apply here.

Changes

fix(config): StrEnum for the str-valued enums. Clears the 6 ruff UP042 errors. MatchMode, Prompts, Effort, CacheMode, MergeMode and ResolutionKind were (str, Enum) mixins, and their str() renders "MatchMode.EAGER", not the value. The config builder parses every enum key with parse_enum(..., str(raw)), so passing an enum member in a config mapping failed:

get_config({"comicbox": {"online": {"lookup": {"match": MatchMode.EAGER}}}})
ValueError: --match: unknown name 'MatchMode.EAGER'; valid: ask, careful, auto, eager

CacheMode dodged this through an isinstance special case in _build_cache; StrEnum makes that redundant, so it's gone. The new tests/unit/test_config_enum_inputs.py fails 4/5 on develop and passes 5/5 here. As a side effect, these members' str() and f-string output is now the value (ask), not MatchMode.ASK; nothing depended on the old form.

refactor: typing.Self for the two cls(...) factory classmethods (CliOverrides.from_auth_list, OnlineSessionState.from_lookup) and two test fakes that return self. Also drops the stale "needed for python 3.10" comment in stamp.py, rewords a 3.10 typeshed comment, and points the righttyper script at 3.11.

v5.3.0. Minor, not patch, because dropping Python 3.10 is breaking. NEWS gets a new section.

ruff format also reformats tests/test_mtime.py, which the datetime.UTC autofix had left unformatted.

Not adopted

No code here benefits from tomllib, exception groups, TaskGroup/asyncio.timeout, hashlib.file_digest, contextlib.chdir or the broader fromisoformat. typing_extensions stays because it's only used for override (3.12). Plain Enum classes with string values stay as they are, because converting them would make their members compare equal to strings.

Verification

  • make fix, make lint and make ty are clean.
  • make test: 2259 passed, 1 skipped on Python 3.14, and the same on 3.11.

🤖 Generated with Claude Code

ajslater and others added 3 commits October 1, 2026 01:21
…onfig

Clears ruff UP042 under the new py311 target. MatchMode, Prompts,
Effort, CacheMode, MergeMode and ResolutionKind were (str, Enum)
mixins, whose str() renders "MatchMode.EAGER" rather than the value.
Config building parses every enum key with parse_enum(..., str(raw)),
so an embedder passing a member in a Mapping config, e.g.
{"online": {"lookup": {"match": MatchMode.EAGER}}}, got a ValueError
listing the very value it passed. Only CacheMode dodged this, through
an isinstance special case that StrEnum makes redundant, so drop it.

Also applies ruff format to tests/test_mtime.py, left unformatted by
the datetime.UTC autofix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… leftovers

typing.Self is stdlib from 3.11. Use it for the two cls(...) factory
classmethods (CliOverrides.from_auth_list, OnlineSessionState.from_lookup)
and for two test fakes that return self.

Remove the stale "needed for python 3.10" comment on datetime.now(tz=UTC),
reword the zipremove typeshed comment, and target 3.11 in the righttyper
script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ajslater
ajslater merged commit 2e8396f into develop Oct 1, 2026
7 checks passed
@ajslater
ajslater deleted the py311-modernize branch October 6, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant