National Infrastructure Resilience Demonstrator (NIRD)
Clone this repository:
git clone [email protected]: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:
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 .
To install new packages, add them to environment.yaml
then run:
micromamba install -f environment.yaml
To add new pre-commit hooks, configure them in .pre-commit-config.yaml
then run:
pre-commit run --all-files
The documentation site is developed in the ./docs
directory using Sphinx.
To build the docs:
cd docs
# generate the API docs (this pulls information from the code and docstrings)
sphinx-apidoc -M -o source/api ../src/nird/ --force
# build the documentation site
make html
To preview the site:
cd build/html
python -m http.server
Then open a browser at the address shown (e.g. http://0.0.0.0:8000
).
This project was developed as part of a UKRI-funded research grant, reference ST/Y003780/1, supported by STFC and DAFNI, within the "Building a Secure and Resilient World" theme.