This release is a pre-release and may not be stable for production use.
Transport Flow Model
This Python package implements iterative capacity-constrained network flow allocation. It routes flows through networks sequentially until link capacities are exhausted, providing a simplified tool for infrastructure risk and resilience analysis.
It is part of the open-source National Infrastructure Systems Model (NISMOD) ecosystem developed by the Oxford Programme for Sustainable Infrastructure Systems (OPSIS) at the University of Oxford.
To run the model:
pip install -e .
python scripts/flow_model/flow_allocation.py ./config.example.json
python scripts/flow_model/flow_disruptions.py ./config.example.json
Development
We recommend the use of pixi to manage a
development environment.
To run the tests (see [tool.pixi.tasks] within pyproject.toml):
pixi run test
Useful Pixi commands:
| Command | Purpose |
|---|---|
pixi run test |
Run the pytest suite. |
pixi run lint |
Run Ruff lint checks. |
pixi run format |
Format Python code with Ruff. |
pixi run docs |
Build the Sphinx HTML documentation. |
pixi run doctest |
Run Sphinx doctests in the documentation. |
pixi run prepare-benchmark-data |
Download and prepare the generated West Yorkshire benchmark dataset. |
pixi run benchmark-scripts-smoke |
Run a quick integration benchmark against config.example.json. |
pixi run benchmark-scripts |
Time the allocation and disruption scripts and write benchmark CSV/JSON output. |
pixi run profile-flow-scripts |
Write CPU/time flamegraphs for allocation and disruption. |
pixi run profile-flow-allocation |
Write a flamegraph for flow_allocation.py. |
pixi run profile-flow-disruptions |
Write a flamegraph for flow_disruptions.py. |
pixi run extension-build |
Build and install the experimental PyO3 Rust extension in the Pixi environment. |
pixi run extension-test |
Run unit tests for the extension. |
pixi run extension-bench |
Run Criterion benchmarks for the extension. |
To add a new package dependency, make sure to use --pypi to include it
in the pyproject.toml dependencies table:
pixi add --pypi geopandas
To add a new development dependency, make sure to use --pypi and --feature dev to include it in the pyproject.toml [dependency-groups] dev table:
pixi add --pypi --feature dev pytest
Acknowledgments
This research received funding from the UK FCDO Climate Compatible Growth Programme. The views expressed here do not necessarily reflect the UK government's official policies.
Metadata
Release files for nismod-tfm 0.2.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nismod_tfm-0.2.0rc1.tar.gz | 31.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nismod_tfm-0.2.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.5 kB
Release files / nismod_tfm-0.2.0rc1.tar.gz
| Download URL | nismod_tfm-0.2.0rc1.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44499a30a53fd5f24b8c831903931b6fe6756bdb4e4f8cd7f4402e626c08fdf6
|
|
BLAKE2b-256 checksum How to use checksums |
288222c3aee7b3ca130eccbcbac59f591ca41878fd5674221f410419da433740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / nismod_tfm-0.2.0rc1-py3-none-any.whl
| Download URL | nismod_tfm-0.2.0rc1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd00b82b2492086639fec1073d2880384a0de4c7908c66784ba11c838b774e91
|
|
BLAKE2b-256 checksum How to use checksums |
999aca4f3a2057bf075c8575f1df7102d1192d0e123106edcf40f8dc9e007481
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency log