Skip to content

Support Python 3.11 and 3.12#49

Merged
lesnik512 merged 7 commits into
mainfrom
feat/python-3.11-3.12-support
Jun 29, 2026
Merged

Support Python 3.11 and 3.12#49
lesnik512 merged 7 commits into
mainfrom
feat/python-3.11-3.12-support

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Lowers the supported-Python floor from 3.13 to 3.11. The package is pure-Python with no compiled extensions, so this is a source-compatibility + metadata change.

Why

Two source constructs were 3.12-only and broke on 3.11 (verified empirically on a real CPython 3.11.9 interpreter):

Construct Location 3.12 3.11
type RedisClient = ... (PEP 695 alias) configs.py OK SyntaxError
override from typing registrator.py, broker.py, subscriber/usecase.py OK ImportError

What changed

  • Backport via typing_extensions (declared as a direct runtime dependency, >=4.12.0 to match faststream's existing transitive pin): @override now imports from typing_extensions; the PEP 695 alias becomes RedisClient: TypeAlias = ... (TypeAlias from stdlib typing, valid since 3.10 — ruff UP035 requires the stdlib form under a py311 target).
  • requires-python: >=3.13,<4>=3.11,<4; added 3.11/3.12 classifiers; ruff target-versionpy311 (so PEP 695 syntax can't reappear).
  • CI: pytest matrix widened to 3.11, 3.12, 3.13, 3.14 (each leg shares the Redis service); lint job stays on 3.13.
  • typing.Self (broker.py) and datetime.UTC (response.py) both exist in the 3.11 stdlib — unchanged, and confirm 3.11 as the correct floor.

Verification

  • 97/97 unit + fake tests on real CPython 3.11 (no Redis needed).
  • 149/149 full suite on 3.13 with 100% coverage (docker + Redis).
  • just lint-ci clean (ruff py311 + ty).
  • The new 3.11/3.12 CI legs are the real cross-version proof — watch them here.

Upstream deps (faststream, redis, anyio) all already declare requires-python >=3.10, so no dependency blocked 3.11.

🤖 Generated with Claude Code

lesnik512 and others added 7 commits June 29, 2026 21:58
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Backport the PEP 695 type alias and typing.override via typing_extensions,
lower requires-python to >=3.11, add 3.11/3.12 classifiers and ruff target.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A start_timeout that fires left the spawned _consume polling task running
(add_task happens before the fail_after wait), since the caller never reaches
__aexit__/stop. The orphan kept a Redis connection alive and deadlocked
fixture/event-loop teardown on slow runners (observed as a hang in the new
3.11 CI leg; faster interpreters tore down before the orphan blocked).

start() now cancels and awaits the poll task if the start signal times out,
so a failed start leaves no orphan. Adds a deterministic regression test
asserting no task leaks after a failed start.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit f2d71ff into main Jun 29, 2026
5 checks passed
@lesnik512 lesnik512 deleted the feat/python-3.11-3.12-support branch June 29, 2026 20:25
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