Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Installation

Requires Python 3.9 or later.

From PyPI

pip install dapi

In a Jupyter notebook

%pip install dapi --quiet

Check version

import dapi
print(dapi.__version__)

Update

pip install --upgrade dapi

Development

Install the dev branch

To test unreleased features from the dev branch:

pip install git+https://github.com/DesignSafe-CI/dapi.git@dev

Or in a DesignSafe Jupyter notebook:

%pip uninstall dapi --yes
%pip install git+https://github.com/DesignSafe-CI/dapi.git@dev --quiet

Restart the kernel after installing.

Local editable install

For local development where changes take effect immediately:

git clone https://github.com/DesignSafe-CI/dapi.git
cd dapi
git checkout dev
pip install -e .

Pre-commit hook

The repo includes a pre-commit hook that auto-formats code with ruff format and blocks commits that fail ruff check:

cp scripts/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

Running tests

pip install pytest
pytest tests/ -v

Linting

ruff format --check .
ruff check .

To auto-fix lint errors:

ruff check --fix .