Skip to content

Upgrade environment for scipy2025 #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- geoviews-core >=1.14.0,<2
- gsw >=3.6.19,<4
- hvplot >=0.11.3,<0.12
- h5netcdf >=1.6.2,<2
- h5netcdf >=1.6.3,<2
- ipykernel >=6.29.5,<7
- matplotlib-base >=3.10.3,<4
- netcdf4 >=1.7.2,<2
Expand All @@ -35,8 +35,9 @@ dependencies:
- sphinx-notfound-page >=1.1.0,<2
- sphinxext-rediraffe >=0.2.7,<0.3
- s3fs >=2025.5.1,<2026
- xarray >=2025.6.1,<2026
- zarr >=3.0.8,<4
- xarray >=2025.7.0,<2026
- zarr >=3.0.10,<4
- flox >=0.10.4,<0.11
- numbagg >=0.9.0,<0.10
- rich >=14.0.0,<15
- python >=3.10
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/devcontainers/base:noble

ARG PIXI_VERSION=v0.49.0

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
45 changes: 35 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
// https://pixi.sh/latest/integration/editor/vscode/#devcontainer-extension
{
"image": "quay.io/pangeo/pangeo-notebook:latest",
"postCreateCommand": {
"vscode": "mkdir ${containerWorkspaceFolder}/.vscode && cp ${containerWorkspaceFolder}/.devcontainer/tasks.json ${containerWorkspaceFolder}/.vscode/tasks.json"
},
"hostRequirements": {
"cpus": 2
"name": "xarray-tutorial",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"customizations": {
"codespaces": {
"openFiles": ["README.md"]
},
"vscode": {
"extensions": ["ms-toolsai.jupyter", "ms-python.python"]
"settings": {},
"extensions": [
"ms-toolsai.jupyter",
"ms-python.python",
"executablebookproject.myst-highlight"
]
}
},
"features": {
// ensure GitHub Codespace 'Open with JupyterLab' works
// TODO: figure out why it doesn't work w/ jupyterlab in the pixi environment
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12",
"installTools": false,
// NOTE: not working, so install with pip in postCreateCommand
// "toolsToInstall":"jupyterlab_myst,pixi-kernel",
"installJupyterlab": true
}
},
"mounts": [
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
],
// These should execute in order below
"onCreateCommand": {
"configure_jupyterlab": "pip install jupyterlab_myst pixi-kernel"
},
"postCreateCommand": {
"set_pixi_permissions": "sudo chown vscode .pixi"
},
"postStartCommand": {
"configure_jupyterlab": "pixi install"
}
}
13 changes: 13 additions & 0 deletions .devcontainer/scipy2025/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/devcontainers/base:noble

ARG PIXI_VERSION=v0.49.0

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
42 changes: 42 additions & 0 deletions .devcontainer/scipy2025/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// https://pixi.sh/latest/integration/editor/vscode/#devcontainer-extension
{
"name": "scipy2025-xarray-tutorial",
"build": {
"dockerfile": "Dockerfile",
"context": "../../"
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-toolsai.jupyter",
"ms-python.python",
"executablebookproject.myst-highlight"
]
}
},
"features": {
// ensure GitHub Codespace 'Open with JupyterLab' works
// TODO: figure out why it doesn't work w/ jupyterlab in the pixi environment
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12",
"installTools": false,
// NOTE: not working, so install with pip in postCreateCommand
// "toolsToInstall":"jupyterlab_myst,pixi-kernel",
"installJupyterlab": true
}
},
"mounts": [
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
],
// These should execute in order below
"onCreateCommand": {
"configure_jupyterlab": "pip install jupyterlab_myst pixi-kernel"
},
"postCreateCommand": {
"set_pixi_permissions": "sudo chown vscode .pixi"
},
"postStartCommand": {
"configure_jupyterlab": "pixi install"
}
}
16 changes: 0 additions & 16 deletions .devcontainer/tasks.json

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Xarray Tutorial

[![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)
[![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)
[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://tutorial.xarray.dev)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/HEAD?labpath=workshops/scipy2024/index.ipynb)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/HEAD?labpath=overview/xarray-in-45-min.ipynb)

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!_

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

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).**

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

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

#### Locally

Expand Down
25 changes: 20 additions & 5 deletions overview/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ Many notebooks use special formatting ([Myst Markdown](https://mystmd.org/guide/

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)

```{warning}
Be patient, it can take a few minutes for a server to become available on the Cloud!
```

#### Mybinder.org

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.

```{warning}
Be patient, it can take a few minutes for a server to become available on the Cloud (Mybinder.org)!
```

#### GitHub Codespaces

This tutorial is available to run within [GitHub Codespaces](https://github.com/features/codespaces) - a preconfigured development environment running in Microsoft Azure.
Expand All @@ -39,13 +39,28 @@ You can choose from a selection of virtual machine types: 2 cores - 8 GB RAM sho
Additionally, you are able to chose from various configurations for specific workshops (such as Scipy2024).
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.

```{tip}
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`
```

Using the GitHub CLI is another very convenient way to start a codespace:

```bash
gh codespace create -R xarray-contrib/xarray-tutorial
```

```bash
# Wait a few minutes for `gh codespace create` to finish, then run:
gh codespace jupyter
```

### On your computer

Running tutorials on your computer requires some setup:

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

```
```bash
git clone https://github.com/xarray-contrib/xarray-tutorial.git
cd xarray-tutorial
pixi run tutorial
Expand Down
Loading
Loading