Skip to content

Development

Note

We are using both Anaconda and Poetry for dependency management - as different platforms require different versions of PyTorch (and its related packages). Also, non-Python packages, i.e., pytorch-cuda (previously named cudatoolkit) and ffmpeg, etc., are installed via Anaconda. We manage other pure-Python dependencies using Poetry.

Install Poetry

We recommend using pipx for installing Poetry:

python3 -m pip install --user pipx
python3 -m pipx ensurepath

Install Poetry on with pipx:

pipx install poetry

Virtual environment with Anaconda

PyTorch related dependencies are defined in environment.yml:

conda env create -f environment.yml -n stegobox

Then activate the environment:

conda activate stegobox

Mamba (drop-in replacement for conda) is also supported and is what we use.

Install dependencies with Poetry

Install remaining dependencies with Poetry inside the conda-created virtual environment:

# Install Poetry dependencies
poetry install

Also install pre-commit hooks:

# Install pre-commit hooks
pre-commit install

# Run against all files if you want
pre-commit run --all-files

Running tests

Unit-testing is managed with pytest.

# Run all tests
pytest

# Run only against your created module
pytest tests/test_<MODULE_NAME>.py