Skip to content

Commit 5a81b50

Browse files
ianhiclaude
andauthored
Add Pixi setup (#613)
* Build: Add pixi configuration for development environment - Initialize pixi with pyproject format (integrated into pyproject.toml) - Add jupyterlab, yarn, and nodejs dependencies - Enables jlpm for building JavaScript/TypeScript code - Lock file for reproducible builds - Update .gitignore for pixi artifacts Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Docs: Update development setup instructions for pixi - Add pixi as recommended development environment setup - Update all commands to use 'pixi run' prefix - Fix watch command to use 'npm run watch' instead of 'jlpm watch' - Keep conda/mamba instructions as alternative - Clarify that pixi handles both Python and Node.js dependencies - Add note about matplotlib requiring compiled dependencies Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Docs: Streamline development setup instructions - Assume JupyterLab by default (most common workflow) - Include watch mode commands in initial setup - Simplify "How to see your changes" section - Move classic notebook setup to end as optional - Group commands more logically - Remove redundant explanations Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Build: Add .yarn/ and package-lock.json to .gitignore - Ignore .yarn/ directory (yarn cache and plugins) - Ignore package-lock.json (npm lock file) - These are build artifacts that shouldn't be committed Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Build: Add test optional dependencies for pixi Add pytest and nbval as optional test dependencies to enable reproducible test environments with pixi. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 57e6053 commit 5a81b50

File tree

4 files changed

+3113
-33
lines changed

4 files changed

+3113
-33
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ lib/
2020
ipympl/nbextension/index.*
2121
ipympl/nbextension/package.json
2222
ipympl/labextension/*.tgz
23+
.yarn/
24+
package-lock.json
2325

2426
ui-tests/test-results
2527
ui-tests/playwright-report
@@ -36,3 +38,5 @@ ipympl/labextension
3638

3739
# sphinx build dir
3840
docs/_build
41+
# pixi environments
42+
.pixi

README.md

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Leveraging the Jupyter interactive widgets framework, `ipympl` enables the inter
1111

1212
Besides, the figure `canvas` element is a proper Jupyter interactive widget which can be positioned in interactive widget layouts.
1313

14-
1514
## Usage
1615

1716
To enable the `ipympl` backend, simply use the `matplotlib` Jupyter
@@ -20,22 +19,26 @@ magic:
2019
```
2120
%matplotlib ipympl
2221
```
22+
2323
## Documentation
24-
See the documentation at: https://matplotlib.org/ipympl/
24+
25+
See the documentation at: <https://matplotlib.org/ipympl/>
26+
2527
## Example
28+
2629
See the [example notebook](https://github.com/matplotlib/ipympl/blob/main/docs/examples/full-example.ipynb) for more!
2730

2831
![matplotlib screencast](matplotlib.gif)
2932

3033
## Installation
3134

32-
### With conda:
35+
### With conda
3336

3437
```bash
3538
conda install -c conda-forge ipympl
3639
```
3740

38-
### With pip:
41+
### With pip
3942

4043
```bash
4144
pip install ipympl
@@ -85,51 +88,61 @@ Versions lookup table:
8588
| 0.3.2 | 0.4.1 | >=1,<2 | |
8689
| 0.3.1 | 0.4.0 | >=0<2 | |
8790

88-
### For a development installation (requires nodejs):
91+
### For a development installation
8992

90-
Create a dev environment that has nodejs installed. The instructions here use
91-
[mamba](https://github.com/mamba-org/mamba#the-fast-cross-platform-package-manager) but you
92-
can also use conda.
93+
We recommend using [pixi](https://pixi.sh) for development as it handles both Python and Node.js dependencies (matplotlib has compiled dependencies).
9394

9495
```bash
95-
mamba env create --file dev-environment.yml
96-
conda activate ipympl-dev
97-
```
96+
# Install dependencies and set up environment
97+
pixi install
9898

99-
Install the Python Packge
100-
```bash
101-
pip install -e .
99+
# Install the Python package in editable mode
100+
pixi run pip install -e .
101+
102+
# Install JavaScript dependencies and build
103+
pixi run jlpm install
104+
pixi run jlpm build
105+
106+
# Set up JupyterLab extension in development mode
107+
pixi run jupyter labextension develop --overwrite .
108+
109+
# Start development workflow (in separate terminals)
110+
pixi run npm run watch # Terminal 1: Auto-rebuild on changes
111+
pixi run jupyter lab # Terminal 2: Run JupyterLab
102112
```
103113

104-
When developing your extensions, you need to manually enable your extensions with the
105-
notebook / lab frontend. For lab, this is done by the command:
114+
**Alternative: Using conda/mamba**
106115

107116
```bash
108-
jupyter labextension develop --overwrite .
117+
mamba env create --file dev-environment.yml
118+
conda activate ipympl-dev
119+
120+
pip install -e .
121+
jlpm install
109122
jlpm build
110-
```
123+
jupyter labextension develop --overwrite .
111124

112-
For classic notebook, you need to run:
113-
```bash
114-
jupyter nbextension install --py --symlink --sys-prefix --overwrite ipympl
115-
jupyter nbextension enable --py --sys-prefix ipympl
125+
# Start development workflow (in separate terminals)
126+
npm run watch # Terminal 1: Auto-rebuild on changes
127+
jupyter lab # Terminal 2: Run JupyterLab
116128
```
117129

118130
#### How to see your changes
119131

120-
**Typescript**:
132+
**TypeScript/JavaScript:** After a change, the watch command will automatically rebuild. Wait for the build to finish, then refresh your browser and the changes should take effect.
121133

122-
If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.
134+
**Python:** If you make a change to the Python code, restart the notebook kernel to have it take effect.
123135

124-
```bash
125-
# Watch the source directory in one terminal, automatically rebuilding when needed
126-
jlpm watch
127-
# Run JupyterLab in another terminal
128-
jupyter lab
129-
```
136+
#### Classic Jupyter Notebook
130137

131-
After a change wait for the build to finish and then refresh your browser and the changes should take effect.
138+
If you need to develop for classic Jupyter Notebook (not JupyterLab), also run:
132139

133-
**Python:**
140+
```bash
141+
# With pixi:
142+
pixi run jupyter nbextension install --py --symlink --sys-prefix --overwrite ipympl
143+
pixi run jupyter nbextension enable --py --sys-prefix ipympl
134144

135-
If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.
145+
# Or with conda/mamba:
146+
jupyter nbextension install --py --symlink --sys-prefix --overwrite ipympl
147+
jupyter nbextension enable --py --sys-prefix ipympl
148+
```

0 commit comments

Comments
 (0)