|
1 | 1 | (developer-installation)= |
2 | 2 | # Developer Installation |
3 | 3 |
|
4 | | -Installing ActivitySim as a developer is almost as easy as just using it, |
5 | | -but making some tweaks to the processes enables live code development and |
6 | | -testing. |
7 | | - |
8 | | -## Package Manager |
9 | | - |
10 | | -ActivitySim has a lot of dependencies. It's easiest and fastest to install |
11 | | -them using a package manager like conda, or its faster and free sibling |
12 | | -[Mambaforge](https://github.com/conda-forge/miniforge#mambaforge). |
13 | | -Depending on your security settings, you might need to install in a |
14 | | -container like docker, instructions for that are coming soon. |
15 | | - |
16 | | -Note that if you are installing `mamba`, you only should install `mamba` |
17 | | -in the *base* environment. If you install `mamba` itself in other environments, |
18 | | -it will not function correctly. If you've got an existing conda installation |
19 | | -and you want to install mamba into it, you can install mamba into the *base* |
20 | | -environment like this: |
21 | | - |
22 | | -```sh |
23 | | -conda update conda -n base |
24 | | -conda install -n base -c conda-forge mamba |
25 | | -``` |
26 | | - |
27 | | -While you are at it, if you are a Jupyter user you might want to also install |
28 | | -`nb_conda_kernels` in your base conda environment alongside any other `jupyter` |
29 | | -libraries: |
30 | | - |
31 | | -```sh |
32 | | -mamba install -n base nb_conda_kernels -c conda-forge |
33 | | -``` |
34 | | - |
35 | | -This will ensure your development environments are selectable as kernels in |
36 | | -Jupyter Notebook/Lab/Etc. |
37 | | - |
38 | | -## Environment |
39 | | - |
40 | | -It's convenient to start from a completely clean conda environment |
41 | | -and git repository. Assuming you have `mamba` installed, and you |
42 | | -want to install in a new directory called "workspace" run: |
43 | | - |
44 | | -```sh |
45 | | -mkdir workspace |
46 | | -cd workspace |
47 | | -mamba env create -p ASIM-ENV --file https://raw.githubusercontent.com/ActivitySim/activitysim/main/conda-environments/activitysim-dev-base.yml |
48 | | -conda activate ./ASIM-ENV |
49 | | -git clone https://github.com/ActivitySim/sharrow.git |
50 | | -python -m pip install -e ./sharrow |
51 | | -git clone https://github.com/ActivitySim/activitysim.git |
52 | | -python -m pip install -e ./activitysim |
53 | | -``` |
54 | | - |
55 | | -Note the above commands will create an environment with all the |
56 | | -necessary dependencies, clone both ActivitySim and sharrow from GitHub, |
57 | | -and `pip install` each of these libraries in editable mode, which |
58 | | -will allow your code changes to be reflected when running ActivitySim |
59 | | -in this environment. |
| 4 | +Installing ActivitySim as a developer is as easy as just using it with *uv*. |
60 | 5 |
|
61 | 6 | Depending on what you are working on, you may want to check out a branch |
62 | | -other than `develop`. To do so, you can point the `git switch` command |
63 | | -above to any other existing branch name. If you want to start an new |
| 7 | +other than the default `main`. To do so, you can use a `git switch` command |
| 8 | +to any other existing branch name. If you want to start an new |
64 | 9 | branch, first create it with `git branch cool-new-feature` and then switch |
65 | 10 | to it with `git switch cool-new-feature`. |
66 | 11 |
|
67 | | -Now your environment should be ready to use. Happy coding! |
| 12 | +By default, *uv* installs projects in editable mode, such that changes to the |
| 13 | +source code are immediately reflected in the environment. |
68 | 14 |
|
69 | 15 | ```{important} |
70 | | -If you add to the ActivitySim dependencies, make sure to also update |
71 | | -the environments in `conda-environments`, which are used for testing |
72 | | -and development. |
| 16 | +If you add to the ActivitySim dependencies during development or remove, make |
| 17 | +sure to use the `uv add` and `uv remove` commands so that the `pyproject.toml` |
| 18 | +and `uv.lock` files are updated correctly and your virtual environment is |
| 19 | +updated. |
73 | 20 | ``` |
0 commit comments