types-networkx
Typing stubs for networkx
What it is and what it does
types-networkx is a type stub package that provides type annotations for the networkx graph library. It allows static type checkers like mypy, pyright, and ty to understand and validate code that uses networkx, catching type errors before runtime. The stubs are maintained as part of the typeshed project and track networkx version 3.6.1.
This package has no runtime behavior—it exists purely to inform type checkers about networkx's API. It depends only on numpy and installs as a single wheel with low friction. The stubs have been tested against mypy 2.3.0, pyright 1.1.411, and ty 0.0.59, and the package is actively maintained with recent updates.
Use it for:
- Enable mypy or pyright type checking in projects that use networkx for graph algorithms and analysis.
- Catch type errors in networkx code during development before they reach production.
- Provide IDE autocomplete and type hints for networkx functions and classes.
- Validate that graph construction and manipulation code conforms to expected types.
- Support continuous integration pipelines that enforce strict type checking on networkx-based code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for networkx to enable static type checking of networkx code with mypy, pyright, and other type checkers.
Yes, if you use networkx and want static type checking. Install it alongside networkx to enable type checkers to validate your graph code. No downside if you don't use type checking—it has no runtime cost and no dependencies beyond numpy. Actively maintained, permissive license, and no known vulnerabilities.
Install
types-networkx on PyPI
pip
pip install types-networkxuv
uv add types-networkxpoetry
poetry add types-networkxInstalling types-networkx
Before you install
Low friction installation with a single wheel distribution. Actively maintained as part of typeshed, with recent releases and no known vulnerabilities.
License in practice
Apache-2.0 permissive license allows use in most projects without significant restrictions.
Quickstart
pip install types-networkx
import networkx as nx
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import types_networkx
G: nx.Graph = nx.Graph()
G.add_edge(1, 2)
Requires Python 3.10 or later; networkx itself must be installed separately for runtime use.
Verify before relying
- Whether installing this package automatically enables type checking without additional mypy/pyright configuration.
- How frequently the stubs are updated relative to networkx releases.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,708,678/month — #3,630 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: types_networkx-3.6.1.20260728-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
types-grpcioProvides type stubs for the grpcio package,…
permissive · top 5,000 on PyPI
types-geopandasProvides type annotations for the geopandas…
permissive · top 15,000 on PyPI
types-mypy-extensionsProvides type stubs for mypy-extensions,…
permissive · top 15,000 on PyPI
types-shapelyProvides type stubs for the shapely package,…
permissive · top 15,000 on PyPI
types-netaddrProvides type stubs for the netaddr package,…
permissive · top 15,000 on PyPI
types-gunicornProvides type stubs for gunicorn to enable…
permissive · top 15,000 on PyPI
types-braintreeProvides type hints for the braintree payment…
permissive · top 15,000 on PyPI
types-pika-tsProvides type stubs for the pika AMQP client…
permissive · top 15,000 on PyPI
types-tqdmProvides type annotations for the tqdm progress…
permissive · top 5,000 on PyPI
types-reportlabProvides type hints for the reportlab PDF…
permissive · top 15,000 on PyPI