types-attrs provides PEP 561 type stubs for the attrs library. However, the attrs library itself has included robust type annotations since version 18.2.0. Consequently, `types-attrs` is largely obsolete and should be uninstalled if you are using attrs version 18.2.0 or newer. It is an auto-generated package from the Python 'typeshed' repository and is considered deprecated for modern `attrs` usage.
pip install types-attrsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining an `attrs` class with type annotations. Note that `types-attrs` is not imported, as the `attrs` library (version 18.2.0 and newer) provides its own type information directly. Type checkers like Mypy will pick up types from the `attrs` package itself.
Uninstall `types-attrs` if your `attrs` version is 18.2.0 or newer: `pip uninstall types-attrs`.
Always annotate all attributes if you use type annotations. For fields needing advanced `attrs` features (like validators, converters, or factories), use `attrs.field()` in conjunction with type annotations. For simple attributes, `attrs.define(auto_attribs=True)` allows omitting `field()` if all attributes are type-annotated.
Either use `attrs.field()` for all attributes, or enable `auto_attribs=True` on the `@define` decorator and ensure *all* attributes are type-annotated to have `attrs` manage them. Use `typing.ClassVar` for true class-level variables that should not be part of the `attrs` instance.
No dependency data recorded yet.