#10132 chore: Use Python 3.13 `Generator` generic type with default `SendType` and `ReturnType`
Pull request opened by edgarrmondragonDescription
SSIA.
• https://docs.python.org/3.13/library/typing.html#annotating-generators-and-coroutines
• PEP 696 – Type Defaults for Type ParametersChecklist
• I have read the contribution guideWas generative AI tooling used to co-author this PR?
• Yes (please specify the tool below)
Related Issues
• Closes #XXXX
Summary by Sourcery
Adopt Python 3.13-compatible Generator and AsyncGenerator type annotations across core modules and tests, using collections.abc with typing_extensions fallbacks, and simplify generator signatures to rely on default Send/Return type parameters.
Enhancements:
• Standardize generator and async generator type hints to use the Python 3.13 Generator/AsyncGenerator generics with default Send/Return types throughout the codebase.
• Introduce conditional imports that prefer collections.abc.Generator/AsyncGenerator on Python 3.13+ and fall back to typing_extensions for earlier versions.
• Align several contextmanager and fixture return annotations from Iterator/AsyncIterator to Generator/AsyncGenerator and adjust some APIs to return Iterable where appropriate (e.g., list_all_files).
meltano/meltano