networkx-stubs

raw JSON →
0.0.1 verified Fri May 01 auth: no python

Type stubs for NetworkX, enabling static type checking. Current version 0.0.1, pre-release quality, low cadence.

pip install networkx-stubs
error Import 'networkx-stubs' could not be resolved
cause Trying to import networkx-stubs directly as a package.
fix
networkx-stubs is not a separate package to import; install it via pip and it augments networkx stubs automatically.
error Module 'networkx' has no attribute 'Graph'
cause Likely networkx not installed or wrong type stub version.
fix
Ensure both networkx and networkx-stubs are installed: pip install networkx networkx-stubs
gotcha Stubs may not cover all NetworkX functions or parameters; some type errors may be missed.
fix Check stubs coverage manually or contribute missing stubs.
gotcha Version 0.0.1 is very early; expect incomplete or incorrect stubs.
fix Use with caution; consider using pyright or mypy without stubs as fallback.

Basic usage with NetworkX – stubs provide type hints.

import networkx as nx
g = nx.Graph()
g.add_edge(1, 2)
print(g)