Skip to content

Commit 2c896d9

Browse files
authored
Upgrade environment for scipy2025 (#327)
* upgrade packages * updated codespace and instructions * add missing dockerfile * separate startup commands * add rich * better codespace instructions
1 parent 3e4365c commit 2c896d9

File tree

10 files changed

+204
-88
lines changed

10 files changed

+204
-88
lines changed

.binder/environment.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- geoviews-core >=1.14.0,<2
2020
- gsw >=3.6.19,<4
2121
- hvplot >=0.11.3,<0.12
22-
- h5netcdf >=1.6.2,<2
22+
- h5netcdf >=1.6.3,<2
2323
- ipykernel >=6.29.5,<7
2424
- matplotlib-base >=3.10.3,<4
2525
- netcdf4 >=1.7.2,<2
@@ -35,8 +35,9 @@ dependencies:
3535
- sphinx-notfound-page >=1.1.0,<2
3636
- sphinxext-rediraffe >=0.2.7,<0.3
3737
- s3fs >=2025.5.1,<2026
38-
- xarray >=2025.6.1,<2026
39-
- zarr >=3.0.8,<4
38+
- xarray >=2025.7.0,<2026
39+
- zarr >=3.0.10,<4
4040
- flox >=0.10.4,<0.11
4141
- numbagg >=0.9.0,<0.10
42+
- rich >=14.0.0,<15
4243
- python >=3.10

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/devcontainers/base:noble
2+
3+
ARG PIXI_VERSION=v0.49.0
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

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1+
// https://pixi.sh/latest/integration/editor/vscode/#devcontainer-extension
12
{
2-
"image": "quay.io/pangeo/pangeo-notebook:latest",
3-
"postCreateCommand": {
4-
"vscode": "mkdir ${containerWorkspaceFolder}/.vscode && cp ${containerWorkspaceFolder}/.devcontainer/tasks.json ${containerWorkspaceFolder}/.vscode/tasks.json"
5-
},
6-
"hostRequirements": {
7-
"cpus": 2
3+
"name": "xarray-tutorial",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"context": ".."
87
},
98
"customizations": {
10-
"codespaces": {
11-
"openFiles": ["README.md"]
12-
},
139
"vscode": {
14-
"extensions": ["ms-toolsai.jupyter", "ms-python.python"]
10+
"settings": {},
11+
"extensions": [
12+
"ms-toolsai.jupyter",
13+
"ms-python.python",
14+
"executablebookproject.myst-highlight"
15+
]
16+
}
17+
},
18+
"features": {
19+
// ensure GitHub Codespace 'Open with JupyterLab' works
20+
// TODO: figure out why it doesn't work w/ jupyterlab in the pixi environment
21+
"ghcr.io/devcontainers/features/python:1": {
22+
"version": "3.12",
23+
"installTools": false,
24+
// NOTE: not working, so install with pip in postCreateCommand
25+
// "toolsToInstall":"jupyterlab_myst,pixi-kernel",
26+
"installJupyterlab": true
1527
}
28+
},
29+
"mounts": [
30+
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
31+
],
32+
// These should execute in order below
33+
"onCreateCommand": {
34+
"configure_jupyterlab": "pip install jupyterlab_myst pixi-kernel"
35+
},
36+
"postCreateCommand": {
37+
"set_pixi_permissions": "sudo chown vscode .pixi"
38+
},
39+
"postStartCommand": {
40+
"configure_jupyterlab": "pixi install"
1641
}
1742
}

.devcontainer/scipy2025/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/devcontainers/base:noble
2+
3+
ARG PIXI_VERSION=v0.49.0
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
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// https://pixi.sh/latest/integration/editor/vscode/#devcontainer-extension
2+
{
3+
"name": "scipy2025-xarray-tutorial",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"context": "../../"
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"settings": {},
11+
"extensions": [
12+
"ms-toolsai.jupyter",
13+
"ms-python.python",
14+
"executablebookproject.myst-highlight"
15+
]
16+
}
17+
},
18+
"features": {
19+
// ensure GitHub Codespace 'Open with JupyterLab' works
20+
// TODO: figure out why it doesn't work w/ jupyterlab in the pixi environment
21+
"ghcr.io/devcontainers/features/python:1": {
22+
"version": "3.12",
23+
"installTools": false,
24+
// NOTE: not working, so install with pip in postCreateCommand
25+
// "toolsToInstall":"jupyterlab_myst,pixi-kernel",
26+
"installJupyterlab": true
27+
}
28+
},
29+
"mounts": [
30+
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
31+
],
32+
// These should execute in order below
33+
"onCreateCommand": {
34+
"configure_jupyterlab": "pip install jupyterlab_myst pixi-kernel"
35+
},
36+
"postCreateCommand": {
37+
"set_pixi_permissions": "sudo chown vscode .pixi"
38+
},
39+
"postStartCommand": {
40+
"configure_jupyterlab": "pixi install"
41+
}
42+
}

.devcontainer/tasks.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Xarray Tutorial
22

3-
[![CI](https://github.com/xarray-contrib/xarray-tutorial/workflows/CI/badge.svg?branch=main)](https://github.com/xarray-contrib/xarray-tutorial/actions?query=branch%3Amain)
3+
[![Deploy Website to GitHub Pages](https://github.com/xarray-contrib/xarray-tutorial/actions/workflows/main.yaml/badge.svg)](https://github.com/xarray-contrib/xarray-tutorial/actions/workflows/main.yaml)
44
[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://tutorial.xarray.dev)
5-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/HEAD?labpath=workshops/scipy2024/index.ipynb)
5+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/HEAD?labpath=overview/xarray-in-45-min.ipynb)
66

77
This is the repository for a Jupyter Book website with tutorial material for [Xarray](https://github.com/pydata/xarray), _an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!_
88

@@ -24,12 +24,14 @@ This tutorial is available to run within [Github Codespaces](https://github.com/
2424

2525
GitHub currently gives every user [120 vCPU hours per month for free](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#monthly-included-storage-and-core-hours-for-personal-accounts), beyond that you must pay. **So be sure to explicitly stop or shut down your codespace when you are done by going to this page (https://github.com/codespaces).**
2626

27-
Once your codespace is launched, the following happens:
27+
You can also use the GitHub CLI to launch a codespace
2828

29-
- [Visual Studio Code](https://code.visualstudio.com/) Interface will open up within your browser.
30-
- A built in terminal will open and it will execute `jupyter lab` automatically.
31-
- Once you see a url to click within the terminal, simply `cmd + click` the given url.
32-
- This will open up another tab in your browser, leading to a [Jupyter Lab](https://jupyterlab.readthedocs.io/en/latest/) Interface.
29+
```
30+
# This will output a URL to use VSCode in the browser
31+
gh codespace create --repo xarray-contrib/xarray-tutorial
32+
# Optionally launch JupyterLab instead of vscode (after codespace has been created)
33+
gh codespace jupyter
34+
```
3335

3436
#### Locally
3537

overview/get-started.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Many notebooks use special formatting ([Myst Markdown](https://mystmd.org/guide/
1919

2020
The easiest way to start modifying and experimenting with tutorial content is to launch a pre-configured server on the Cloud. This is easy thanks to several free resources which offer ephemeral computing instances (be aware you may loose your connection or work at any time)
2121

22+
```{warning}
23+
Be patient, it can take a few minutes for a server to become available on the Cloud!
24+
```
25+
2226
#### Mybinder.org
2327

2428
Clicking [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/HEAD) will load a pre-configured Jupyter Lab interface with _all_ tutorial notebooks for you to run. _You have minimal computing resources and any changes you make will not be saved._ Any page with executable content also has a {octicon}`rocket;2em` icon in the upper right that will launch an interactive session for that particular page.
2529

26-
```{warning}
27-
Be patient, it can take a few minutes for a server to become available on the Cloud (Mybinder.org)!
28-
```
29-
3030
#### GitHub Codespaces
3131

3232
This tutorial is available to run within [GitHub Codespaces](https://github.com/features/codespaces) - a preconfigured development environment running in Microsoft Azure.
@@ -39,13 +39,28 @@ You can choose from a selection of virtual machine types: 2 cores - 8 GB RAM sho
3939
Additionally, you are able to chose from various configurations for specific workshops (such as Scipy2024).
4040
GitHub currently gives every user [120 vCPU hours per month for free](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#monthly-included-storage-and-core-hours-for-personal-accounts), beyond that you must pay. **So be sure to explicitly stop your codespace when you are done by going to this page (https://github.com/codespaces).** You can also chose to fully delete your codespace when you're done exploring tutorial content.
4141

42+
```{tip}
43+
By default Codespaces open VSCode in a browser window. But you can also launch a JupyterLab interface. Once you've launched a codespace, use the auto-generated name in the following URL: `https://github.com/codespaces/CODESPACE-NAME?editor=jupyter`
44+
```
45+
46+
Using the GitHub CLI is another very convenient way to start a codespace:
47+
48+
```bash
49+
gh codespace create -R xarray-contrib/xarray-tutorial
50+
```
51+
52+
```bash
53+
# Wait a few minutes for `gh codespace create` to finish, then run:
54+
gh codespace jupyter
55+
```
56+
4257
### On your computer
4358

4459
Running tutorials on your computer requires some setup:
4560

4661
We recommend using [`pixi`](https://pixi.sh/latest/) to ensure a fully reproducible Python environment
4762

48-
```
63+
```bash
4964
git clone https://github.com/xarray-contrib/xarray-tutorial.git
5065
cd xarray-tutorial
5166
pixi run tutorial

0 commit comments

Comments
 (0)