refactor(python): use built-in type hinting generics
Closed
TI
2mo ago+14187+14187+01234567890123456789012345678901234567890123456789-14423-14423-01234567890123456789012345678901234567890123456789
these are supported from 3.9 onwards, matching the current python constraint, so non-breaking
https://stackoverflow.com/questions/37087457/difference-between-defining-typing-dict-and-dict#37087556
https://peps.python.org/pep-0585/
Summary by cubic
Refactor Python generators, templates, and samples to use built-in generics (dict/list/tuple/set) per PEP 585, and harden codegen to prevent schema/container keywords from leaking into model imports. No behavior changes; Python 3.9+ only.
- Refactors
- Templates (
python,pydantic-v1,fastapi,flask,aiohttp,blueplanet): replacedtyping.Dict/List/Tuple/Setwithdict/list/tuple/set, updatedClassVar[...]andtype[T], removed unusedtypingimports, and adjusted docstrings. - Clients/helpers:
RequestSerialized, response/header maps, and configTypedDicts use built-ins; ApiClient deserializers now matchlist[anddict[; asyncio REST kwargs/maps usedict[str, Any]; FastAPI base API usesClassVar[tuple]; security scope helpers expectlist[str]. - Codegen safeguards: removed
List/Dictprimitives and per-generatorarray/map/setoverrides; centralized mappings in abstract Python codegens; added guards so container names and schema keywords don’t enter model imports; tests updated to assert built-ins only. - Docs/samples: dropped
Dict/Listfrom language primitives; regenerated docs, tests, and sample clients to use built-ins.
- Templates (