Development

The backend is Python glue around published rustworkx wheels. Each wrapper converts arguments, calls a rustworkx implementation, and maps the result back to NetworkX's public shape.

Set up

git clone https://github.com/thevilledev/nx-rustworkx.git
cd nx-rustworkx
uv sync --extra test

Editable installation without uv:

pip install -e ".[test]"

Tests

uv run pytest tests

The package suite compares results with NetworkX function by function. Signature tests also require every backend function to preserve NetworkX's positional parameters and defaults.

NetworkX's own algorithm suite is the broader compatibility check:

NETWORKX_TEST_BACKEND=rustworkx pytest --pyargs networkx.algorithms

Static checks

uv run zizmor .
uv run pyright
uv run python scripts/pyruff_check.py

zizmor audits GitHub Actions, pyright checks types, and pyruff checks lint and formatting. The current pyruff release requires Python 3.11 or newer.

Layout

nx_rustworkx/
  interface.py          BackendInterface
  convert.py            NetworkX <-> rustworkx and node maps
  graph.py              rustworkx-backed graph object
  generators.py         graph constructors and native generators
  algorithms/           thin wrappers by algorithm area
  _info.py              backend metadata and caveats

benches/                parity, generator, and centrality benchmarks
tests/                  package and dispatch tests
website/                this static documentation site

Each module in algorithms/ lists the NetworkX functions it implements in __all__. Their union drives both the backend interface and the metadata published to NetworkX.

Backend entry points

[project.entry-points."networkx.backends"]
rustworkx = "nx_rustworkx.interface:BackendInterface"

[project.entry-points."networkx.backend_info"]
rustworkx = "nx_rustworkx._info:get_info"

Contributing

Add or change a wrapper only when its result matches NetworkX's public contract. Include parity tests, declare unsupported argument shapes in can_run, and let benchmark evidence decide whether should_run selects it automatically.

Use issues for bugs and proposals. Contributions are BSD-3-Clause.