Skip to content

Commit 2e89521

Browse files
authored
Enable pure pip/uv installations (#683)
* add uv lock to gitignore * pull tables from pypi instead of conda-forge * remove tables drom docs requirements.txt * updated installation guide * Disable HDF5 file locking in tox * Revert "Disable HDF5 file locking in tox" This reverts commit 8173f32. * updated instruction for creating a dev environment * remove mamba link from url scheme * Revert "linkcheck ignore BraiAn" This reverts commit 7e5a7e0. * Implement suggestions from PR review * tweak wording in uv venv instructions
1 parent bdfa988 commit 2e89521

File tree

6 files changed

+173
-88
lines changed

6 files changed

+173
-88
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ venv/
9292

9393
# pre-commit and pytest cache
9494
.*_cache/
95+
96+
# uv related
97+
uv.lock

CONTRIBUTING.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,67 @@ These are especially suitable if you're new to the project, and we recommend sta
2525

2626
## Contributing code
2727

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

35-
First, create and activate a `conda` environment with some prerequisites:
30+
In order to make changes to `movement`, you will need to fork the [repository](movement-github:).
31+
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).
3632

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

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

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

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

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

55-
```bash
56-
pre-commit install
57-
```
48+
::::{tab-set}
49+
50+
:::{tab-item} conda
51+
First, create and activate a `conda` environment:
52+
53+
```sh
54+
conda create -n movement-dev -c conda-forge python=3.13
55+
conda activate movement-dev
56+
```
57+
58+
Then, install the package in editable mode with development dependencies:
59+
60+
```sh
61+
pip install -e ".[dev]"
62+
```
63+
:::
64+
65+
:::{tab-item} uv
66+
67+
First, create and activate a [virtual environment](uv:pip/environments/):
68+
69+
```sh
70+
uv venv --python=3.13
71+
source .venv/bin/activate # On macOS and Linux
72+
.venv\Scripts\activate # On Windows PowerShell
73+
```
74+
75+
Then, install the package in editable mode with development dependencies:
76+
77+
```sh
78+
uv pip install -e ".[dev]"
79+
```
80+
:::
81+
82+
::::
83+
84+
4. Finally, initialise the [pre-commit hooks](#formatting-and-pre-commit-hooks):
85+
86+
```sh
87+
pre-commit install
88+
```
5889

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

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

218-
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:
248+
To build the documentation locally, install the extra dependencies by running the following command from the repository root:
219249
```sh
220-
pip install -r ./docs/requirements.txt
250+
pip install -r ./docs/requirements.txt # conda env
251+
uv pip install -r ./docs/requirements.txt # uv env
221252
```
222253

223254
Now create a new branch, edit the documentation source files (`.md` or `.rst` in the `docs` folder),

docs/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ sphinx-design
1111
sphinx-gallery
1212
sphinx-notfound-page
1313
sphinx-sitemap
14-
tables

docs/source/conf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@
191191
"https://opensource.org/license/bsd-3-clause/", # to avoid odd 403 error
192192
"https://www.sainsburywellcome.org/", # Occasional ConnectTimeoutError
193193
"https://www.robots.ox.ac.uk/", # occasional 404s
194-
"https://silvalab.codeberg.page/BraiAn/", # SSLError despite working link
195194
]
196195

197196

@@ -203,11 +202,10 @@
203202
"movement-github": "https://github.com/neuroinformatics-unit/movement/{{path}}",
204203
"movement-zulip": "https://neuroinformatics.zulipchat.com/#narrow/stream/406001-Movement",
205204
"movement-community-calls": "https://neuroinformatics.zulipchat.com/#narrow/channel/406001-Movement/topic/Community.20Calls",
206-
"conda": "https://docs.conda.io/en/latest/",
205+
"conda": "https://docs.conda.io/projects/conda/en/latest/{{path}}#{{fragment}}",
207206
"dlc": "https://www.mackenziemathislab.org/deeplabcut/",
208207
"gin": "https://gin.g-node.org/{{path}}#{{fragment}}",
209208
"github-docs": "https://docs.github.com/en/{{path}}#{{fragment}}",
210-
"mamba": "https://mamba.readthedocs.io/en/latest/",
211209
"myst-parser": "https://myst-parser.readthedocs.io/en/latest/{{path}}#{{fragment}}",
212210
"napari": "https://napari.org/dev/{{path}}",
213211
"setuptools-scm": "https://setuptools-scm.readthedocs.io/en/latest/{{path}}#{{fragment}}",
@@ -220,6 +218,7 @@
220218
"via": "https://www.robots.ox.ac.uk/~vgg/software/via/{{path}}#{{fragment}}",
221219
"anipose": "https://anipose.readthedocs.io/en/latest/",
222220
"TRex": "https://trex.run/docs/",
221+
"uv": "https://docs.astral.sh/uv/{{path}}#{{fragment}}",
223222
}
224223

225224
intersphinx_mapping = {
Lines changed: 109 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,104 @@
11
(target-installation)=
22
# Installation
33

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

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

1610
::::{tab-set}
17-
:::{tab-item} Conda
18-
To create an environment with the core package only:
11+
:::{tab-item} conda
12+
Create and activate a new [conda environment](conda:user-guide/tasks/manage-environments.html):
1913
```sh
20-
conda create -n movement-env -c conda-forge movement
14+
conda create -y -n movement-env -c conda-forge python=3.13
15+
conda activate movement-env
2116
```
2217

23-
If you wish to use the GUI, which additionally requires [napari](napari:),
24-
you should instead run:
18+
We used `movement-env` as the environment name, but you can choose any name you prefer.
19+
:::
20+
21+
:::{tab-item} uv
22+
Create and activate a new [virtual environment](uv:pip/environments/) inside your project directory:
23+
2524
```sh
26-
conda create -n movement-env -c conda-forge movement napari pyqt
25+
uv venv --python=3.13
26+
27+
source .venv/bin/activate # On macOS and Linux
28+
.venv\Scripts\activate # On Windows PowerShell
2729
```
28-
You may exchange `pyqt` for `pyside2` if you prefer.
29-
See [napari's installation guide](napari:tutorials/fundamentals/installation.html)
30-
for more information on the backends.
30+
:::
31+
::::
3132

32-
To activate the environment:
33+
## Install the package
34+
With your environment activated, install `movement` using one of the methods below.
35+
36+
::::{tab-set}
37+
:::{tab-item} From conda-forge using conda
38+
Install the core package:
3339
```sh
34-
conda activate movement-env
40+
conda install -c conda-forge movement
3541
```
36-
:::
3742

38-
:::{tab-item} Pip
39-
Create and activate an environment with some prerequisites:
43+
If you wish to use the GUI, which requires [napari](napari:), run instead:
4044
```sh
41-
conda create -n movement-env -c conda-forge python=3.12 pytables
42-
conda activate movement-env
45+
conda install -c conda-forge movement napari pyqt
4346
```
44-
Install the core package from the latest release on PyPI:
47+
You may exchange `pyqt` for `pyside6` if you prefer a different Qt backend.
48+
See [napari's installation guide](napari:tutorials/fundamentals/installation.html)
49+
for more details on available backends.
50+
51+
:::
52+
53+
:::{tab-item} From PyPI using pip
54+
Install the core package:
4555
```sh
4656
pip install movement
4757
```
48-
If you wish to use the GUI, which additionally requires [napari](napari:),
49-
you should instead run:
58+
If you wish to use the GUI, which requires [napari](napari:), run instead:
59+
```sh
60+
pip install "movement[napari]"
61+
```
62+
:::
63+
64+
:::{tab-item} From PyPI using uv
65+
Install the core package:
66+
```sh
67+
uv pip install movement
68+
```
69+
If you wish to use the GUI, which requires [napari](napari:), run instead:
5070
```sh
51-
pip install movement[napari] # works on most shells
52-
pip install 'movement[napari]' # works on zsh (default shell on macOS)
71+
uv pip install "movement[napari]"
5372
```
5473
:::
74+
5575
::::
5676

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

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

65-
### Developers
66-
If you are a developer looking to contribute to movement, please refer to our [contributing guide](target-contributing) for detailed setup instructions and guidelines.
86+
:::{admonition} For developers
87+
:class: tip
88+
89+
If you would like to contribute to `movement`, see our [contributing guide](target-contributing)
90+
for detailed developer setup instructions and coding guidelines.
91+
:::
6792

68-
## Check the installation
69-
To verify that the installation was successful, run (with `movement-env` activated):
93+
## Verify the installation
94+
With your virtual environment activated, run:
7095
```sh
7196
movement info
7297
```
73-
You should see a printout including the version numbers of movement
98+
You should see a printout including the version numbers of `movement`
7499
and some of its dependencies.
75100

76-
To test the GUI installation, you can run:
101+
To test the GUI installation:
77102

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

85110
## Update the package
86-
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:
111+
112+
:::{dropdown} Always update using the same package manager used for installation
113+
:icon: info
114+
:color: info
115+
116+
If your environment was created with `conda`, first check which channel `movement` was installed from before updating.
117+
Run `conda list movement` in your active `conda` environment and look at the **Channel** column:
118+
- If the channel is `conda-forge`, update using `conda`.
119+
- If the channel is `pypi`, update using `pip`.
120+
121+
:::
122+
123+
124+
::::{tab-set}
125+
:::{tab-item} conda
87126
```sh
88-
conda list movement
127+
conda update -c conda-forge movement -y
89128
```
90-
If the output shows `conda-forge` as the channel, you used `conda` to install it. If it shows `pypi`, you used `pip`.
129+
:::
91130

92-
Once this is clear, you can update `movement` by running the relevant command from below:
93-
::::{tab-set}
94-
:::{tab-item} Conda
131+
:::{tab-item} pip
95132
```sh
96-
conda update movement -y
133+
pip install -U movement
97134
```
98135
:::
99136

100-
:::{tab-item} Pip
137+
:::{tab-item} uv
101138
```sh
102-
pip install movement -U
139+
uv pip install -U movement
103140
```
104141
:::
105142
::::
106143

107144

108-
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`:
145+
If the above fails, try installing `movement` in a fresh new environment to avoid dependency conflicts.
146+
147+
First remove the existing environment:
148+
149+
::::{tab-set}
150+
:::{tab-item} conda
109151
```sh
110152
conda env remove -n movement-env
111153
```
112-
Once the environment has been removed, you can create a new one following the [installation instructions](#install-the-package) above.
113154

114-
:::{tip}
115-
If you are unsure about the environment name, you can get a list of the environments on your system with:
155+
This command assumes your environment is named `movement-env`.
156+
If you are unsure about the name, you can get a list of the environments
157+
on your system with `conda env list`.
158+
:::
159+
160+
:::{tab-item} uv
161+
Delete the `.venv` folder in your project directory.
162+
163+
```powershell
164+
rm -rf .venv # On macOS and Linux
165+
rmdir /s /q .venv # On Windows PowerShell
166+
```
167+
168+
Optionally, you can clean the `uv` cache for unused packages:
116169
```sh
117-
conda env list
170+
uv cache prune
118171
```
119172
:::
173+
::::
174+
175+
Once the environment has been removed, you can create a new one following the [instructions](#create-a-virtual-environment) above.

0 commit comments

Comments
 (0)