Skip to content

Lower python version to use 3.10#9

Merged
alexachille merged 2 commits intostrands-labs:mainfrom
xiddw:lower-python-version
Apr 29, 2026
Merged

Lower python version to use 3.10#9
alexachille merged 2 commits intostrands-labs:mainfrom
xiddw:lower-python-version

Conversation

@xiddw
Copy link
Copy Markdown
Contributor

@xiddw xiddw commented Apr 27, 2026

What does this change do?

Lowers the minimum Python version from 3.12 to 3.10 by replacing PEP 695 generic syntax with the equivalent TypeVar/ParamSpec/Generic pattern.

Why are you making this change?

Python 3.10 and 3.11 are still actively supported (EOL Oct 2026 and Oct 2027 respectively). The only thing requiring 3.12 was PEP 695 syntax — no other 3.11+ features are used and all dependencies already support 3.10. This broadens compatibility with no functional or API changes.

Changes

  • 5 source files — rewrite generics to old-style TypeVar/ParamSpec/Generic (core.py, decorator.py, types/graph.py, memory/base.py, utils/_async.py)
  • pyproject.tomlrequires-python >= 3.10, added 3.10/3.11 classifiers
  • README.md & docs/tutorial.md — updated version references, clarified that 3.14+ recommendation is for native t-string support
  • core.py — fixed pre-existing mypy arg-type error on Agent hooks parameter

How was this tested?

  • All 327 tests pass (hatch run test)
  • Formatting clean (hatch run format)
  • Linting clean (hatch run lint)
  • Type checking clean (hatch run typecheck)

Note

This can be reverted once Python 3.11 reaches EOL (October 2027) and the minimum is raised to 3.12, which natively supports PEP 695 syntax.

Closes #8


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

xiddw added 2 commits April 27, 2026 14:45
Replace PEP 695 generic syntax (class Foo[T]:, def foo[T]():) with the
equivalent TypeVar/ParamSpec/Generic pattern supported since Python 3.10.
This is the only change needed since no other 3.11+ features are used
and all dependencies already support 3.10.

Files changed:
- core.py, decorator.py, types/graph.py, memory/base.py, utils/_async.py:
  rewrite generics to old-style TypeVar/ParamSpec/Generic
- pyproject.toml: requires-python >=3.10, add 3.10/3.11 classifiers

Note: This can be reverted once Python 3.11 reaches EOL (October 2027)
and the minimum supported version is raised to 3.12, which natively
supports PEP 695 syntax.
The hooks field passed via **agent_kwargs has type list[HookProvider] | None
but Agent expects list[HookProvider | HookCallback[Any]] | None. This is a
type variance issue with mutable containers — list is invariant in mypy. Add
arg-type to the existing type: ignore comment to suppress it.
@alexachille alexachille self-assigned this Apr 29, 2026
Copy link
Copy Markdown
Contributor

@alexachille alexachille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! We originally set 3.12+ defensively for future flexibility, but fair point: we're not using anything beyond PEP 695, and broader version support is a win.

@alexachille alexachille merged commit 2abc198 into strands-labs:main Apr 29, 2026
1 check passed
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.

Lower minimum Python version from 3.12 to 3.10

2 participants