You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use uv, overhaul dev setup, update contributor docs (#1392)
* add developer environment file
* use uv, rename commands to match JL convention
* add dev setup script
* add ci setup script
* overhaul contributor documentation
* fix typo
* install uv in CI setup
* always use conda-forge channel
* set up `uv` in CI using the official GH action
* fix conda shell hook & catch more errors
Copy file name to clipboardExpand all lines: docs/source/contributors/index.md
+82-43Lines changed: 82 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,81 +22,120 @@ You can develop Jupyter AI on any system that can run a supported Python version
22
22
23
23
You should have the newest supported version of JupyterLab installed.
24
24
25
-
We highly recommend that you install [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) to start contributing to Jupyter AI, especially if you are developing on macOS on an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.).
26
-
27
25
You will need [a supported version of node.js](https://github.com/nodejs/release#release-schedule) to use Jupyter AI.
28
26
29
-
:::{warning}
30
-
:name: node-18-15
31
-
Due to a compatibility issue with Webpack, Node.js 18.15.0 does not work with Jupyter AI.
32
-
:::
27
+
## Automatic development setup (recommended)
28
+
29
+
To get a development setup automatically, you must first install a Python
30
+
environment manager. The development setup script currently supports
31
+
`micromamba`, `mamba`, or `conda`.
33
32
34
-
## Development install
35
-
After you have installed the prerequisites, create a new conda environment and activate it.
33
+
We recommend
34
+
[micromamba](https://micromamba.readthedocs.io/en/latest/installation.html) for
35
+
its speed and minimal footprint. Alternatively, you can install
36
+
[mamba](https://mamba.readthedocs.io/en/latest/installation.html) or
This command must be run from the root of the monorepo (`<jupyter-ai-top>`).
50
+
This script will automatically create and set up a Jupyter AI development
51
+
environment named `jaidev` for you, using the environment manager available on
52
+
your system. Specifically, this script will:
43
53
44
-
```
45
-
# Move to the root of the repo package
46
-
cd <jupyter-ai-top>
54
+
- Detect your Python environment manager (micromamba, mamba, or conda),
55
+
- Create a 'jaidev' Python environment with Python 3.11, Node.js 20, JupyterLab 4.4+, and `uv`,
56
+
- Install all JavaScript dependencies,
57
+
- Builds all frontend assets,
58
+
- Perform editable installation of all Jupyter AI packages, and
59
+
- Install documentation dependencies.
60
+
61
+
After this is complete, you can start and launch JupyterLab in your default
62
+
browser by running `jlpm dev` or simply `jupyter lab`.
63
+
64
+
## Manual development setup
65
+
66
+
To perform a minimal development setup in another Python environment without
67
+
using `dev-setup.sh`, first verify that the below prerequisites are installed in
68
+
your environment:
69
+
70
+
- Python 3.9 - 3.11
71
+
72
+
- JupyterLab >=4.4
73
+
74
+
- Any [maintained](https://github.com/nodejs/release#release-schedule) version of `nodejs`
75
+
76
+
-[`uv`](https://docs.astral.sh/uv/)
77
+
78
+
Then, run these commands:
47
79
48
-
# Installs all the dependencies and sets up the dev environment
49
-
./scripts/install.sh
80
+
```py
81
+
# Install JS dependencies
50
82
jlpm
51
-
jlpm build
52
-
```
53
83
54
-
Start and launch JupyterLab in your default browser:
84
+
# Build frontend assets
85
+
jlpm build
55
86
87
+
# Perform editable installation of all Jupyter AI packages
88
+
# This can also be done via the alias `jlpm di`
89
+
jlpm dev:install
56
90
```
57
-
jlpm dev
58
-
```
59
91
60
-
You can open a new terminal and use that to build and push changes to the repository. Enter the `conda` environment and build the project after making any changes.
92
+
## Development builds
93
+
94
+
You can open a new terminal and use that to build local changes to the
95
+
repository. Make sure to activate the `jaidev` environment each time you begin
96
+
development from a new terminal:
61
97
62
98
```
63
-
cd <jupyter-ai-top>
64
-
conda activate jupyter-ai
99
+
{micromamba,mamba,conda} activate jaidev
100
+
101
+
# Build frontend assets
65
102
jlpm build
66
103
```
67
104
68
-
To change what Jupyter AI packages are installed in your dev environment, use the `dev-uninstall` script:
105
+
`jlpm build` only needs to be run after modifying anything related to the
106
+
frontend (e.g. `*.ts`, `*.tsx`, `*.css` files). The browser has to be refreshed
107
+
to reflect new changes to the frontend.
108
+
109
+
To only build a subset of Jupyter AI packages, use the `--scope` argument that
110
+
gets forwarded to Lerna:
69
111
70
112
```
71
-
# uninstalls all Jupyter AI packages
72
-
jlpm dev-uninstall
113
+
# Builds frontend assets only for `packages/jupyter-ai` and its dependencies
114
+
jlpm build --scope "@jupyter-ai/core"
73
115
```
74
116
75
-
To reinstall Jupyter AI packages back into your dev environment, use the `dev-install` script:
117
+
Note that after making changes to anything backend-related (e.g. `*.py` files),
118
+
you must restart the server for those changes to take effect. You can restart
119
+
the server by first typing `Ctrl + C` in the terminal running it, then running
120
+
`jlpm dev` or `jupyter lab` to restart it.
76
121
77
-
```
78
-
# installs all Jupyter AI packages
79
-
jlpm dev-install
80
-
```
122
+
## Development reinstall
81
123
82
-
To only install/uninstall a subset of Jupyter AI packages, use the `--scope` argument that gets forwarded to Lerna:
124
+
To reinstall all Jupyter AI packages, run:
83
125
84
126
```
85
-
# installs jupyter_ai_magics and its dependencies
86
-
jlpm dev-install --scope "@jupyter-ai/magics"
87
-
```
88
-
89
-
## Making changes while your server is running
127
+
# reinstalls all Jupyter AI packages
128
+
jlpm dev:reinstall
90
129
91
-
If you change, add, or remove a **magic command**, after rebuilding, restart the kernel
92
-
or restart the server.
130
+
# or, use the convenient alias:
131
+
jlpm dr
132
+
```
93
133
94
-
If you make changes to the **user interface** or **lab extension**, run `jlpm build` and then
95
-
refresh your browser tab.
134
+
This is generally necessary when updating `pyproject.toml` files.
96
135
97
136
## Building documentation
98
137
99
-
The `./scripts/install.sh` should automatically install the documentation
138
+
The `./scripts/dev-setup.sh` should automatically install the documentation
100
139
dependencies. You will need to install [pandoc](https://pandoc.org/) as well. You can install [pandoc from the conda-forge channel](https://anaconda.org/conda-forge/pandoc):
0 commit comments