- clone the dynamic_routing_analysis repo
- create a new environment with python=3.11.5
conda create -n dr_analysis python=3.11.5
- navigate to the folder where you cloned the repo
- activate your new environment
conda activate dr_analysis
- Optional: if you want to plot on the CCF, install allensdk (not necessary for other analyses; workaround to override some of allensdk's deps with dynamic_routing_analysis deps)
pip install allensdk
- install remaining dependencies from requirements.txt file
pip install -r requirements.txt
- install dynamic_routing_analysis in editable mode
pip install -e .
-
duplicate the dev capsule https://codeocean.allenneuraldynamics.org/capsule/3127916
-
attach AWS and GitHub credentials (requires an access token)
-
fire up VSCode
-
pull from origin/main, activate and update the dev venv outside of conda:
conda deactivate source install.sh
-
verify that the venv is activated in VSCode
Ctrl+Shift+P
and start typing any part ofPython: Select Interpreter
- the interpreter should be set to
Python 3.9.12 ('.venv': venv) ./.venv/bin/python
- if that's not an option, hit the refresh button
- if it still doesn't appear, hit
Enter interpreter path...
and enter./.venv/bin/python
-
verify that the venv is activated in a new terminal
[Ctrl+Shift+`]
the folder name and Python version should be indicated on the command line (e.g.
dra-3.9
):(dra-3.9) root@c5876abdc7b5:/code/dra# |
- Make sure to check for updates in the source control tab in VSCode
[Ctrl+Shift+G]
and pull where appropriate - Update the venv in a terminal with
pdm update
-
when adding, this method will find a compatible version of the dependency, based on the package's Python version requirement and other existing dependencies
-
the dependency will be added/removed from:
- pyproject.toml, which specifies required dependencies
- the currently-activated dev venv
- if removed, all of its sub-dependencies will also be removed
- pdm.lock, which specifies the dev venv
- commit any changes to the
pdm.lock
to signal updates to the common dev venv - if you're unsure if your lock file is correct, run
pdm update
- this will add add the most up-to-date versions of dependencies specifed in pyproject.toml - if your venv is broken, delete the
.venv
folder and re-install
- commit any changes to the
For dependencies of the package itself (ie. needed for code within dynamic_routing_analysis
):
pdm add numpy pandas
pdm remove numpy pandas
For dependencies needed for development of the package (ie. testing, linting, formatting, static type-analysis):
pdm add -G dev mypy pytest
pdm remove -G dev mypy pytest
If we specify only a lower bound on a dependency (e.g. pandas >= 2.0
), any new install of dynamic_routing_analysis
will also install the latest version of pandas
.
To make sure that the latest versions of dependencies don't introduce breaking changes, we should update the dev venv periodically by running pdm update
and running any tests, then committing pdm.lock.
More info on pdm
and the lock file: https://pdm.fming.dev/latest/usage/dependency/#install-the-packages-pinned-in-lock-file