Contributing

Warning

This section of the documentation in under construction.

py-clesperanto is a Python API layer for the CLIc library. Several operation and functionality are directly inherited from the CLIc library, compiled and imported in the package as _clesperanto. Arround this C++ core, the package as several Python code to ensure proper integration with the Python ecosystem (numpy, etc.).

Therefore, it is possible to contribute to the development of py-clesperanto either on the C++ side or on the Python side depending on what you are trying to achieve.

Environment setup

Like for any other python development we encourage you to use a virtual environment to develop py-clesperanto. Here we will describe how to setup a development environment for py-clesperanto with conda/mamba.

  1. Create a new environment with conda/mamba:

mamba create -n pycle-dev python=3.9 -c conda-forge
conda activate pycle-dev
  1. Install the dependencies:

mamba install -c conda-forge numpy pytest jupyter scikit-image black flake8 pre-commit
  1. Setup pre-commit:

pre-commit install
  1. Install py-clesperanto in development mode:

pip install . -v
  1. Run the tests:

pytest

All tests should pass. The pip install command will compile and install the package in the environment. You will now be able to modify the pyclesperanto package and see the changes directly in the environment. The pre-commit tool will ensure that the code is properly formatted and linted before any commit.

Warning

-e flag of the pip install command is not available for the moment.

Versioning

pyClesperanto version folows the CLIc versioning. Although they are not necessarily made to be identically, the versioning is kept in sync as much as possible.

In order to update the version of pyClesperanto, you will need to follow the following steps:

  1. Update the CLIc version tag used in the CMakeLists.txt file at the root of the project.

  2. Update the version in the pyproject.toml file.

  3. Update the version in the pyclesperanto/_version.py file. Both VERSION and CLIC_VERSION should be updated accordingly.

Note

The version tag in the pyproject.toml file should be made automatic in the near future.