Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ venv/

# pre-commit and pytest cache
.*_cache/

# uv related
uv.lock
83 changes: 57 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,67 @@ These are especially suitable if you're new to the project, and we recommend sta

## Contributing code


### Creating a development environment
It is recommended to use [conda](conda:)
or [mamba](mamba:) to create a
development environment for `movement`. In the following we assume you have
`conda` installed, but the same commands will also work with `mamba`/`micromamba`.

First, create and activate a `conda` environment with some prerequisites:
In order to make changes to `movement`, you will need to fork the [repository](movement-github:).
If you are not familiar with `git`, we recommend reading up on [this guide](https://docs.github.com/en/get-started/using-git/about-git#basic-git-commands).

```sh
conda create -n movement-dev -c conda-forge python=3.13 pytables
conda activate movement-dev
```
1. Clone the forked repository to your local machine and change directory:

To install `movement` for development, clone the [GitHub repository](movement-github:),
and then run from within the repository:
```sh
git clone https://github.com/<your-github-username>/movement.git
cd movement
```

```sh
pip install -e .[dev] # works on most shells
pip install -e '.[dev]' # works on zsh (the default shell on macOS)
```
2. Set the upstream remote to the base `movement` repository:

This will install the package in editable mode, including all dependencies
required for development.
```sh
git remote add upstream https://github.com/neuroinformatics-unit/movement.git
```

Finally, initialise the [pre-commit hooks](#formatting-and-pre-commit-hooks):
3. Create an environment using [conda](conda:) or [uv](uv:getting-started/installation/) and install `movement` in editable mode, including development dependencies.

```bash
pre-commit install
```
::::{tab-set}

:::{tab-item} conda
First, create and activate a `conda` environment:

```sh
conda create -n movement-dev -c conda-forge python=3.13
conda activate movement-dev
```

Then, install the package in editable mode with development dependencies:

```sh
pip install -e ".[dev]"
```
:::

:::{tab-item} uv

First, create and activate a [virtual environment](uv:pip/environments/):

```sh
uv venv --python=3.13
source .venv/bin/activate # On macOS and Linux
.venv\Scripts\activate # On Windows PowerShell
```

Then, install the package in editable mode with development dependencies:

```sh
uv pip install -e ".[dev]"
```
:::

::::

4. Finally, initialise the [pre-commit hooks](#formatting-and-pre-commit-hooks):

```sh
pre-commit install
```

### Pull requests
In all cases, please submit code to the main repository via a pull request (PR).
Expand Down Expand Up @@ -212,12 +243,12 @@ The deployment job runs on tag pushes (for PyPI releases) or manual triggers on
This keeps the documentation aligned with releases, while allowing manual redeployment when necessary.

### Editing the documentation
To edit the documentation, first clone the repository, and install `movement` in a
[development environment](#creating-a-development-environment).
To edit the documentation, ensure you have already set up a [development environment](#creating-a-development-environment).

Then, install a few additional dependencies in your development environment to be able to build the documentation locally. To do this, run the following command from the root of the repository:
To build the documentation locally, install the extra dependencies by running the following command from the repository root:
```sh
pip install -r ./docs/requirements.txt
pip install -r ./docs/requirements.txt # conda env
uv pip install -r ./docs/requirements.txt # uv env
```

Now create a new branch, edit the documentation source files (`.md` or `.rst` in the `docs` folder),
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ sphinx-design
sphinx-gallery
sphinx-notfound-page
sphinx-sitemap
tables
5 changes: 2 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@
"https://opensource.org/license/bsd-3-clause/", # to avoid odd 403 error
"https://www.sainsburywellcome.org/", # Occasional ConnectTimeoutError
"https://www.robots.ox.ac.uk/", # occasional 404s
"https://silvalab.codeberg.page/BraiAn/", # SSLError despite working link
]


Expand All @@ -203,11 +202,10 @@
"movement-github": "https://github.com/neuroinformatics-unit/movement/{{path}}",
"movement-zulip": "https://neuroinformatics.zulipchat.com/#narrow/stream/406001-Movement",
"movement-community-calls": "https://neuroinformatics.zulipchat.com/#narrow/channel/406001-Movement/topic/Community.20Calls",
"conda": "https://docs.conda.io/en/latest/",
"conda": "https://docs.conda.io/projects/conda/en/latest/{{path}}#{{fragment}}",
"dlc": "https://www.mackenziemathislab.org/deeplabcut/",
"gin": "https://gin.g-node.org/{{path}}#{{fragment}}",
"github-docs": "https://docs.github.com/en/{{path}}#{{fragment}}",
"mamba": "https://mamba.readthedocs.io/en/latest/",
"myst-parser": "https://myst-parser.readthedocs.io/en/latest/{{path}}#{{fragment}}",
"napari": "https://napari.org/dev/{{path}}",
"setuptools-scm": "https://setuptools-scm.readthedocs.io/en/latest/{{path}}#{{fragment}}",
Expand All @@ -220,6 +218,7 @@
"via": "https://www.robots.ox.ac.uk/~vgg/software/via/{{path}}#{{fragment}}",
"anipose": "https://anipose.readthedocs.io/en/latest/",
"TRex": "https://trex.run/docs/",
"uv": "https://docs.astral.sh/uv/{{path}}#{{fragment}}",
}

intersphinx_mapping = {
Expand Down
162 changes: 109 additions & 53 deletions docs/source/user_guide/installation.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,104 @@
(target-installation)=
# Installation

## Install the package
:::{admonition} Use a conda environment
:class: note
To avoid dependency conflicts with other packages, it is best practice to install Python packages within a virtual environment.
We recommend using [conda](conda:) or [mamba](mamba:) to create and manage this environment, as they simplify the installation process.
The following instructions assume that you have conda installed, but the same commands will also work with `mamba`/`micromamba`.
:::
## Create a virtual environment

### Users
To install movement in a new environment, follow one of the options below.
We will use `movement-env` as the environment name, but you can choose any name you prefer.
While not strictly required, we strongly recommended installing `movement` in a
clean virtual environment, using tools such as
[conda](conda:) or [uv](uv:getting-started/installation/).

::::{tab-set}
:::{tab-item} Conda
To create an environment with the core package only:
:::{tab-item} conda
Create and activate a new [conda environment](conda:user-guide/tasks/manage-environments.html):
```sh
conda create -n movement-env -c conda-forge movement
conda create -y -n movement-env -c conda-forge python=3.13
conda activate movement-env
```

If you wish to use the GUI, which additionally requires [napari](napari:),
you should instead run:
We used `movement-env` as the environment name, but you can choose any name you prefer.
:::

:::{tab-item} uv
Create and activate a new [virtual environment](uv:pip/environments/) inside your project directory:

```sh
conda create -n movement-env -c conda-forge movement napari pyqt
uv venv --python=3.13

source .venv/bin/activate # On macOS and Linux
.venv\Scripts\activate # On Windows PowerShell
```
You may exchange `pyqt` for `pyside2` if you prefer.
See [napari's installation guide](napari:tutorials/fundamentals/installation.html)
for more information on the backends.
:::
::::

To activate the environment:
## Install the package
With your environment activated, install `movement` using one of the methods below.

::::{tab-set}
:::{tab-item} From conda-forge using conda
Install the core package:
```sh
conda activate movement-env
conda install -c conda-forge movement
```
:::

:::{tab-item} Pip
Create and activate an environment with some prerequisites:
If you wish to use the GUI, which requires [napari](napari:), run instead:
```sh
conda create -n movement-env -c conda-forge python=3.12 pytables
conda activate movement-env
conda install -c conda-forge movement napari pyqt
```
Install the core package from the latest release on PyPI:
You may exchange `pyqt` for `pyside6` if you prefer a different Qt backend.
See [napari's installation guide](napari:tutorials/fundamentals/installation.html)
for more details on available backends.

:::

:::{tab-item} From PyPI using pip
Install the core package:
```sh
pip install movement
```
If you wish to use the GUI, which additionally requires [napari](napari:),
you should instead run:
If you wish to use the GUI, which requires [napari](napari:), run instead:
```sh
pip install "movement[napari]"
```
:::

:::{tab-item} From PyPI using uv
Install the core package:
```sh
uv pip install movement
```
If you wish to use the GUI, which requires [napari](napari:), run instead:
```sh
pip install movement[napari] # works on most shells
pip install 'movement[napari]' # works on zsh (default shell on macOS)
uv pip install "movement[napari]"
```
:::

::::

:::{dropdown} Note for Apple Silicon users with macOS 13 or earlier
:color: info
:icon: info

We recommend installing `movement` following the `Conda` instructions above, as the `pip` method will likely fail for you.
Alternatively, updating your macOS to version 14 or later will allow `pip` installations to work as expected.
If you are using macOS 13 or earlier on Apple Silicon (M-series),
we recommend installing `movement` via `conda-forge`.
Alternatively, upgrade to macOS 14 to use any of the installation methods above.
:::

### Developers
If you are a developer looking to contribute to movement, please refer to our [contributing guide](target-contributing) for detailed setup instructions and guidelines.
:::{admonition} For developers
:class: tip

If you would like to contribute to `movement`, see our [contributing guide](target-contributing)
for detailed developer setup instructions and coding guidelines.
:::

## Check the installation
To verify that the installation was successful, run (with `movement-env` activated):
## Verify the installation
With your virtual environment activated, run:
```sh
movement info
```
You should see a printout including the version numbers of movement
You should see a printout including the version numbers of `movement`
and some of its dependencies.

To test the GUI installation, you can run:
To test the GUI installation:

```sh
movement launch
Expand All @@ -83,37 +108,68 @@ This is equivalent to running `napari -w movement` and should open the `napari`
window with the `movement` widget docked on the right-hand side.

## Update the package
To update `movement` to the latest version, you need to use the same package manager you used to install it (either `conda` or `pip`). If you are not sure which one you used, you can run from your active environment:

:::{dropdown} Always update using the same package manager used for installation
:icon: info
:color: info

If your environment was created with `conda`, first check which channel `movement` was installed from before updating.
Run `conda list movement` in your active `conda` environment and look at the **Channel** column:
- If the channel is `conda-forge`, update using `conda`.
- If the channel is `pypi`, update using `pip`.

:::


::::{tab-set}
:::{tab-item} conda
```sh
conda list movement
conda update -c conda-forge movement -y
```
If the output shows `conda-forge` as the channel, you used `conda` to install it. If it shows `pypi`, you used `pip`.
:::

Once this is clear, you can update `movement` by running the relevant command from below:
::::{tab-set}
:::{tab-item} Conda
:::{tab-item} pip
```sh
conda update movement -y
pip install -U movement
```
:::

:::{tab-item} Pip
:::{tab-item} uv
```sh
pip install movement -U
uv pip install -U movement
```
:::
::::


If the above fails, try installing it in a fresh new environment instead. This should prevent potential compatibility issues caused by changes in dependency versions. You can first uninstall the existing environment named `movement-env`:
If the above fails, try installing `movement` in a fresh new environment to avoid dependency conflicts.

First remove the existing environment:

::::{tab-set}
:::{tab-item} conda
```sh
conda env remove -n movement-env
```
Once the environment has been removed, you can create a new one following the [installation instructions](#install-the-package) above.

:::{tip}
If you are unsure about the environment name, you can get a list of the environments on your system with:
This command assumes your environment is named `movement-env`.
If you are unsure about the name, you can get a list of the environments
on your system with `conda env list`.
:::

:::{tab-item} uv
Delete the `.venv` folder in your project directory.

```powershell
rm -rf .venv # On macOS and Linux
rmdir /s /q .venv # On Windows PowerShell
```

Optionally, you can clean the `uv` cache for unused packages:
```sh
conda env list
uv cache prune
```
:::
::::

Once the environment has been removed, you can create a new one following the [instructions](#create-a-virtual-environment) above.
Loading
Loading