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
This commit is contained in:
Jeremy Tuloup 2025-03-11 22:10:21 +01:00 committed by GitHub
parent 82a81c502c
commit bf1530f1b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 3395 additions and 2 deletions

13
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM mcr.microsoft.com/devcontainers/base:jammy
ARG PIXI_VERSION=v0.42.1
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" \
&& chmod +x /usr/local/bin/pixi \
&& pixi info
# set some user and workdir settings to work nicely with vscode
USER vscode
WORKDIR /home/vscode
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc

View File

@ -0,0 +1,21 @@
{
"name": "Jupyter Notebook",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"forwardPorts": [8888],
"customizations": {
"vscode": {
"settings": {},
"extensions": ["ms-python.python", "charliermarsh.ruff", "GitHub.copilot"]
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"mounts": [
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
],
"postCreateCommand": "sudo chown vscode .pixi && pixi install && pixi run develop && pixi run pre-commit install -f"
}

View File

@ -18,3 +18,6 @@ app/index.template.js
# ms IDE stuff
.history/
.vscode/
# Pixi environments
.pixi

2
.gitattributes vendored Normal file
View File

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

4
.gitignore vendored
View File

@ -138,3 +138,7 @@ ui-tests/.pnp.*
# generated html
notebook/templates/*.html
# pixi environments
.pixi
*.egg-info

View File

@ -33,6 +33,7 @@ repos:
exclude: |
(?x)^(
yarn.lock|
pixi.lock|
binder/example.ipynb|
docs/source/examples/images/FrontendKernel.graffle/data.plist|
)$

View File

@ -9,3 +9,4 @@ node_modules
build
CHANGELOG.md
app/index.template.js
.pixi

View File

@ -22,7 +22,7 @@ mamba create -n notebook -c conda-forge python nodejs -y
mamba activate notebook
# Install package in development mode
pip install -e ".[dev,test]"
pip install -e ".[dev,docs,test]"
# Install dependencies and build packages
jlpm
@ -240,6 +240,10 @@ Now open a web browser and navigate to `http://localhost:8000` to access the doc
Alternatively you can also contribute to Jupyter Notebook without setting up a local environment, directly from a web browser:
- [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:
- Run `pixi shell` in a terminal to activate the development environment
- Use the commands above for building the extension and running the tests, for example: `jlpm build`
- 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.
- [Gitpod](https://gitpod.io/#https://github.com/jupyter/notebook) integration is enabled. The Gitpod config automatically builds the Jupyter Notebook application and the documentation.
- GitHubs [built-in editor](https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files) is suitable for contributing small fixes
- 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,
- 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

3322
pixi.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -289,3 +289,25 @@ exclude = ["tests", "ui-tests", "docs", "node_modules", "setup.py"]
[tool.repo-review]
ignore = ["GH102", "PC180", "PC111"]
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]
[tool.pixi.pypi-dependencies]
notebook = { path = ".", editable = true, extras = ["dev", "docs"] }
[tool.pixi.environments]
default = { solve-group = "default" }
dev = { features = ["dev"], solve-group = "default" }
docs = { features = ["docs"], solve-group = "default" }
test = { features = ["test"], solve-group = "default" }
[tool.pixi.tasks]
develop = "jlpm develop"
start = "jupyter notebook --no-browser --ServerApp.token='' --ServerApp.allow_remote_access=True"
[tool.pixi.dependencies]
pip = ">=25.0.1,<26"
nodejs = "22.*"
python = ">=3.12.0,<3.14"