skillfed

types-networkx

Typing stubs for networkx

types-networkx v3.6.1.20260728 1.7M downloads/30d#3,630 on PyPI37
Permissive license Apache-2.0 Active released

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-networkx

uv

uv add types-networkx

poetry

poetry add types-networkx

Installing 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

Programming Language :: Python :: 3Typing :: Stubs Only

Tags

networkx type stubstype checking networkxnetworkx typing annotationsmypy networkx supportstatic type checking graphsnetworkx type hintspyright networkx
type-stubsstatic-analysis

More Software Development packages