Guide/In production
Production Deployment Notes
2 min readFrom the README
On this page 7
A practical checklist for shipping fnx in production.
Dependency pinning
# requirements.txt or pyproject.toml [tool.poetry.dependencies]
franken-networkx = "==0.4.1"
networkx = "==3.6.1" # qualified oracle; package minimum is 3.4
Pin fnx exactly during early development (0.x). The fnx parity guarantee includes "we won't change observable behavior of a supported algorithm without a version bump", and pinning gives you that guarantee in your dependency graph.
Wheel selection
PyPI (release 0.4.1) ships pre-built ABI3 wheels plus the source distribution for:
- Linux x86_64 (manylinux_2_17 / manylinux2014)
- Linux aarch64 (manylinux_2_17 / manylinux2014)
- Linux x86_64 musl (musllinux_1_2)
- macOS x86_64 (10.12+)
- macOS arm64 (11.0+)
- Windows x86_64
The 0.4.1 source distribution includes the declared root LICENSE file and
python/fnx_backend_info.py shim (#7),
so platforms without a pre-built wheel can build from the published sdist.
Memory considerations
Without attributes the slot/IndexMap adjacency is denser than NetworkX's dict-of-dicts: 112 MiB against NetworkX's 177 MiB (0.63×) for 200k nodes and 800k edges. Attributes currently cost more than in NetworkX, because an attributed edge is stored twice — as a native AttrMap the kernels read and as the Python dict users see. Same graph with one float attribute per edge: 944 MiB against NetworkX's 276 MiB (3.4×) when built with add_edges_from or add_weighted_edges_from, 500 MiB (1.8×) when the attribute is added afterwards with set_edge_attributes (Python dicts then materialise lazily). Measured 2026-09-24, RSS delta of one build per process, same_host=thinkstation1, no A/A null (a sanity measurement, not a gate).
Budget accordingly for large attributed graphs; a single attribute store is on the storage roadmap (br-r37-c1-epic-storage-architecture-yr2oc).
Multiprocessing
The _fnx cdylib is safe to import from multiple Python processes. Standard caveats apply:
- Use
multiprocessing.set_start_method("spawn")on macOS (default since 3.8) and modern Linux. - Graphs do not share memory across processes; serialize via
pickle, JSON node-link, or write to a file. - Each process initializes its own thread-local CGSE witness ledger.
Async / threading
- fnx algorithm calls release the GIL during native execution. Using a
ThreadPoolExecutorto run algorithms concurrently on independent graphs is the correct pattern. - Calls that mutate a shared graph from multiple threads are not safe; serialize the mutator from a single thread.
asyncioworks trivially; algorithm calls are blocking, so wrap them withloop.run_in_executor(None, fn, args).
Logging and tracing
import logging
logging.basicConfig(level=logging.INFO)
# Rust-side `log` records are forwarded into Python's logging module (pyo3-log)
# under the logger name "franken_networkx".
logging.getLogger("franken_networkx").setLevel(logging.DEBUG)
Logging is sparse: 11 Rust call sites in all (ten in shortest-path kernels at INFO, add_node at DEBUG). add_edge, remove_edge and remove_node do not log: resolving the logger cost about 500 instructions per call on those paths. There is no tracing instrumentation and RUST_LOG is not read; configure levels through Python's logging. The backend dispatch layer does not log dispatch decisions today.
Container image notes
If you're shipping fnx inside a Docker image, a minimal layer set:
FROM python:3.12-slim
RUN pip install --no-cache-dir franken-networkx
# Optional SciPy (NumPy is a required dependency and already installed)
RUN pip install --no-cache-dir 'franken-networkx[all]'
The wheels are self-contained; no apt packages needed. Final image cost is ~80 MB beyond the base Python image.