A collection of reusable type definitions, protocols, and type aliases for Python type annotations.
useful_types is a Python library that provides a collection of reusable type definitions, protocols, and type aliases for enhancing type annotations in Python code. It solves the problem of repeatedly defining the same types across different projects by offering a standardized set that can be easily imported or vendored.
Python developers who use type checkers like mypy or pyright and want to reduce boilerplate while maintaining consistent and expressive type annotations in their codebases.
Developers choose useful_types for its convenience in standardizing common types, its compatibility with major type checkers, and the flexibility to vendor types without adding external dependencies.
Useful types for Python
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Pre-defines common types and protocols, eliminating repetitive manual definitions and promoting consistency across projects, as highlighted in the description.
Explicitly supports mypy 1.4 and pyright 1.1.314 or higher, ensuring reliable compatibility with modern type checking tools, per the README.
Types are not special-cased by type checkers, allowing easy copying and integration into projects without external dependencies, offering flexibility.
Incorporates newer type checker capabilities, enabling more expressive annotations without needing custom implementations.
Some types depend on newer type checker features, which may cause issues in environments with outdated tools, as admitted in the README.
Provides only type annotations without any runtime code or utilities, limiting its use for projects that need both type hints and implementation.
The curated collection might not cover all niche or project-specific type needs, requiring users to still define custom types in some cases.