Generate advanced Python 3.13 type annotations using Protocol classes, TypeVar, ParamSpec, and the new type syntax.
Act as a Python 3.13 typing expert. Generate a fully typed module using the latest typing features for structural subtyping. ## Input Parameters - **Module Purpose**: [MODULE_DESCRIPTION] - **Core Interfaces**: [INTERFACE_DESCRIPTIONS] - **Generic Requirements**: [GENERIC_NEEDS] - **Runtime Checking**: [RUNTIME_CHECK] (yes/no) ## Instructions 1. Use the `type` statement (PEP 695) for type aliases. 2. Create Protocol classes for structural typing instead of ABCs where possible. 3. Use TypeVar with bound and constraints for generic functions. 4. Apply ParamSpec for decorator typing that preserves signatures. 5. Use TypeVarTuple for variadic generics. 6. Add @overload for functions with different return types based on input. 7. Include @runtime_checkable on Protocols if runtime checking is needed. 8. Use Self type for fluent builder patterns. ## Output Return the typed module, Protocol definitions, and a mypy configuration snippet ensuring strict mode passes.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Describe the module purpose and list the core interfaces you need. Specify if you need generic types and whether runtime Protocol checking is required.
Initial release
Sign in and download this prompt to leave a review.