National Infrastructure Resilience Demonstrator

nird is a Python package to help with analysis of the resilience of national infrastructure networks.

nird on github

Development setup

Clone this repository:

git clone git@github.com:nismod/DAFNI-NIRD.git

(Or, if you prefer to use HTTPS authentication, git clone https://github.com/nismod/DAFNI-NIRD.git)

Move into the cloned folder:

cd DAFNI-NIRD

Create a conda environment using micromamba to install packages specified in the ``environment.yaml` file <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually>`_:

micromamba env create -f environment.yaml

(In case micromamba fails to install pip packages, you can install them manually by running micromamba activate nerd then pip install --editable .[dev])

Activate it:

micromamba activate nird

Configure the pre-commit checks:

pre-commit install

There are several tools and helpers set up to run automatically, on git commit and in GitHub Actions continuous integration steps. Each of these can be run locally too.

Run the tests using pytest:

python -m pytest

Run formatting using black:

black .

Run linting using ruff:

ruff check .

Run type-checking using mypy:

mypy --strict .

Updating setup

To install new packages, add them to environment.yaml then run:

micromamba install -f environment.yaml

Contents

Indices and tables