This package provides static type checking stubs for the `netaddr` library, enabling tools like MyPy or Pyright to perform comprehensive type analysis on code that uses `netaddr`. It is part of the Python typeshed project, which maintains type hints for popular Python packages. The current version is `1.3.0.20260408` and it follows the release cadence of the typeshed project, updating frequently to reflect changes in `netaddr`.
pip install types-netaddrVerified import paths — ran on the pinned version, not inferred.
To use `types-netaddr`, you first need to install both `netaddr` and `types-netaddr`. You then write your Python code using `netaddr` with type hints as usual. A type checker like MyPy or Pyright will automatically find and utilize the stubs provided by `types-netaddr` during static analysis, without requiring any special imports from `types_netaddr` itself. The example shows a simple function using `IPAddress` with type hints, which would be checked by a type checker.
Ensure both `pip install netaddr` and `pip install types-netaddr` are executed.
All imports should be `from netaddr import ...`.
Ensure you are using a type checker in your development workflow to benefit from the stubs.