Skip to content

Commit d5de930

Browse files
committed
better codespace instructions
1 parent cd2d305 commit d5de930

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

.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+
}

README.md

Lines changed: 2 additions & 2 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

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)