FrankenNetworkX

Guide/In production

Development

1 min readFrom the README

On this page 3
Building from source on a fresh machineCross-compilation notesEditor / IDE setup
# clone
git clone https://github.com/Dicklesworthstone/franken_networkx
cd franken_networkx

# install build deps
pip install maturin pytest hypothesis networkx numpy scipy

# dev loop: debug build, edit, repeat
maturin develop --features pyo3/abi3-py310

# release build (recommended for benchmarks)
maturin develop --release --features pyo3/abi3-py310

# run tests (guarded: memory and time limits; target files or shards)
./scripts/run_pytest_guarded.sh tests/python/test_error_messages.py -v

# verify docs
python3 scripts/verify_docs.py

# build a wheel
maturin build --release

# Rust-side checks
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

ABI3 builds a single wheel that works on Python 3.10, 3.11, 3.12, and 3.13; no per-version matrix is needed.

Building from source on a fresh machine

# Rust toolchain (nightly, pinned by rust-toolchain.toml)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustup component add rustfmt clippy

# Python build deps
python3 -m venv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install maturin pytest hypothesis networkx numpy scipy

# Clone + build
git clone https://github.com/Dicklesworthstone/franken_networkx
cd franken_networkx
maturin develop --release --features pyo3/abi3-py310

# Smoke test
python -c "import franken_networkx as fnx; G = fnx.path_graph(5); print(fnx.shortest_path(G, 0, 4))"

Cold build time on a modern laptop (16-core, 32 GB): about 4 minutes for a release build. Incremental builds run in seconds for most edits.

Cross-compilation notes

Release wheels are built by DSR (dsr build franken_networkx) on its Linux, macOS and Windows build hosts. For local cross-compilation, maturin build --release --target=... works if you have the corresponding Rust target installed (rustup target add ...). The cdylib doesn't have any platform-specific code paths today.

To verify an existing publication without compiling or installing anything, use the retained-artifact verifier with the expected release source commit:

python3 scripts/verify_published_release.py --version 0.4.1 \
  --source-commit <release-commit-sha> \
  --evidence-dir /path/to/new/fnx-publication-evidence

It checks the public tag, exact DSR asset inventory, Minisign-signed checksum manifest, and the actual bytes of all six PyPI wheels. The evidence directory must be new; downloads and receipts remain there. --python /path/to/venv/bin/python also probes an already-installed consumer's weighted algorithms, wide unsigned matrix conversion, and NetworkX backend discovery/dispatch. This optional probe does not install or upgrade a package, and the receipt reports when it was not run.

Editor / IDE setup

The project ships a rust-toolchain.toml so rust-analyzer and rustfmt honor the pinned nightly. For VS Code, install:

  • rust-lang.rust-analyzer
  • tamasfe.even-better-toml
  • vadimcn.vscode-lldb for debugging

For Python, pylance or pyright will pick up the type stubs from python/franken_networkx/_fnx.pyi automatically.