Skip to content

Commit bf1530f

Browse files
authored
Add devcontainer support, backed by pixi (#7602)
* Add pixi based devcontainer * Update devcontainer.json * update pixi deps * fixes * tweaks * add start task * lint * Mention codespaces in the contributing guide * add install command * tweaks * fix * fix * update contributing
1 parent 82a81c5 commit bf1530f

10 files changed

+3395
-2
lines changed

.devcontainer/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
ARG PIXI_VERSION=v0.42.1
4+
5+
RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix-dev/pixi/releases/download/${PIXI_VERSION}/pixi-$(uname -m)-unknown-linux-musl" \
6+
&& chmod +x /usr/local/bin/pixi \
7+
&& pixi info
8+
9+
# set some user and workdir settings to work nicely with vscode
10+
USER vscode
11+
WORKDIR /home/vscode
12+
13+
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc

.devcontainer/devcontainer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "Jupyter Notebook",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"forwardPorts": [8888],
8+
"customizations": {
9+
"vscode": {
10+
"settings": {},
11+
"extensions": ["ms-python.python", "charliermarsh.ruff", "GitHub.copilot"]
12+
}
13+
},
14+
"features": {
15+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
16+
},
17+
"mounts": [
18+
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
19+
],
20+
"postCreateCommand": "sudo chown vscode .pixi && pixi install && pixi run develop && pixi run pre-commit install -f"
21+
}

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ app/index.template.js
1818
# ms IDE stuff
1919
.history/
2020
.vscode/
21+
22+
# Pixi environments
23+
.pixi

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,7 @@ ui-tests/.pnp.*
138138

139139
# generated html
140140
notebook/templates/*.html
141+
142+
# pixi environments
143+
.pixi
144+
*.egg-info

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ repos:
3333
exclude: |
3434
(?x)^(
3535
yarn.lock|
36+
pixi.lock|
3637
binder/example.ipynb|
3738
docs/source/examples/images/FrontendKernel.graffle/data.plist|
3839
)$

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ node_modules
99
build
1010
CHANGELOG.md
1111
app/index.template.js
12+
.pixi

CONTRIBUTING.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mamba create -n notebook -c conda-forge python nodejs -y
2222
mamba activate notebook
2323

2424
# Install package in development mode
25-
pip install -e ".[dev,test]"
25+
pip install -e ".[dev,docs,test]"
2626

2727
# Install dependencies and build packages
2828
jlpm
@@ -240,6 +240,10 @@ Now open a web browser and navigate to `http://localhost:8000` to access the doc
240240

241241
Alternatively you can also contribute to Jupyter Notebook without setting up a local environment, directly from a web browser:
242242

243+
- [GitHub CodeSpaces](https://github.com/codespaces) is directly integrated into GitHub. This repository uses the [pixi](https://pixi.sh/) package manager to set up the development environment. To contribute after the Codespace is started:
244+
- Run `pixi shell` in a terminal to activate the development environment
245+
- Use the commands above for building the extension and running the tests, for example: `jlpm build`
246+
- To start the application: `pixi run start`. A popup should appear with a button to open the Jupyter Notebook in a new browser tab. If the popup does not appear, you can navigate to the "Forwarded ports" panel to find the URL to the application.
243247
- [Gitpod](https://gitpod.io/#https://github.com/jupyter/notebook) integration is enabled. The Gitpod config automatically builds the Jupyter Notebook application and the documentation.
244248
- GitHub’s [built-in editor](https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files) is suitable for contributing small fixes
245-
- A more advanced [github.dev](https://docs.github.com/en/codespaces/the-githubdev-web-based-editor) editor can be accessed by pressing the dot (.) key while in the Jupyter Notebook GitHub repository,
249+
- A more advanced [github.dev](https://docs.github.com/en/codespaces/the-githubdev-web-based-editor) editor can be accessed by pressing the dot (.) key while in the Jupyter Notebook GitHub repository

pixi.lock

+3,322
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+22
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,25 @@ exclude = ["tests", "ui-tests", "docs", "node_modules", "setup.py"]
289289

290290
[tool.repo-review]
291291
ignore = ["GH102", "PC180", "PC111"]
292+
293+
[tool.pixi.project]
294+
channels = ["conda-forge"]
295+
platforms = ["linux-64"]
296+
297+
[tool.pixi.pypi-dependencies]
298+
notebook = { path = ".", editable = true, extras = ["dev", "docs"] }
299+
300+
[tool.pixi.environments]
301+
default = { solve-group = "default" }
302+
dev = { features = ["dev"], solve-group = "default" }
303+
docs = { features = ["docs"], solve-group = "default" }
304+
test = { features = ["test"], solve-group = "default" }
305+
306+
[tool.pixi.tasks]
307+
develop = "jlpm develop"
308+
start = "jupyter notebook --no-browser --ServerApp.token='' --ServerApp.allow_remote_access=True"
309+
310+
[tool.pixi.dependencies]
311+
pip = ">=25.0.1,<26"
312+
nodejs = "22.*"
313+
python = ">=3.12.0,<3.14"

0 commit comments

Comments
 (0)