Installation¶
Warning
Leaspy requires Python >= 3.9, <= 3.13.
Tip
Whether you wish to install a released version of Leaspy, or to install its development version, it is highly recommended to use a virtual environment to install the project and its dependencies.
There are multiple solutions for that, the most common option is to use conda:
conda create --name leaspy python=3.10
conda activate leaspy
1. Install a released version¶
To install the latest version of Leaspy:
pip install leaspy
2. Install in development mode¶
If you haven’t done it already, create and activate a dedicated environment.
2.1 Clone the repository¶
To install the project in development mode, you first need to get the source code by cloning the project’s repository:
git clone git@gitlab.com:icm-institute/aramislab/leaspy.git
cd leaspy
2.2 Install poetry¶
This project relies on poetry which you will need to install (see the official instructions).
Tip
It is recommended to install it in a dedicated environment, separated from the one in which you will install Leaspy and its dependencies. One possibility is to install it with a tool called pipx.
If you don’t have pipx installed already, you can follow the official installation guidelines.
In short, you can do:
pip install pipx
pipx ensurepath
pipx install poetry
2.3 Install Leaspy and its dependencies¶
Install leaspy in development mode:
poetry install
2.4 Install the pre-commit hook¶
Once you have installed Leaspy in development mode, do not forget to install the pre-commit hook in order to automatically format and lint your commits:
pipx install pre-commit
pre-commit install
3. Notebook configuration¶
After installation, you can run the examples in the next section.
To do so, in your leaspy environment, you can download ipykernel to use leaspy with jupyter notebooks:
conda install ipykernel
python -m ipykernel install --user --name=leaspy
Now, you can open jupyter lab or jupyter notebook and select the leaspy kernel.