Installation¶
For developers¶
First, ensure that you have poetry installed. The recommended way to install poetry is using pipx
:
pipx install poetry
For pipx
installation see here. Optionally, if working on HPC,
to manage storage in an efficient manner, ensure caches for different libraries are pointed to your scratch space.
This can be done by setting the environment variables for perturb-lib
, poetry
, and pip
as follows:
SCRATCH_DIR=/your/path/to/scratch/space
export PERTURB_LIB_CACHE_DIR=$SCRATCH_DIR/plib_cache
export POETRY_CACHE_DIR=$SCRATCH_DIR/poetry_cache
export PIP_CACHE_DIR=$SCRATCH_DIR/pip_cache
This can be automated by placing the code into .bash_profile
. Next, install perturb-lib
dependencies in the development mode. All the requirements are listed in pyproject.toml
. It is recommended (but not necessary) to install all dependency groups.
poetry install --with dev,docs,benchmarking
Installing pre-commit hooks can be done as follows:
poetry run pre-commit install
Finally, execute commands through poetry environment Simply use prefix poetry run
in front of python commands. For example, tests can be performed by running:
poetry run pytest
Alternatively, you can first enter poetry environment first using poetry shell
and then run python commands as usual.