Skip to content

Commit 00dae00

Browse files
Add codespace to main (#198)
* Add default main devcontainer config * Remove . from json config * Update README * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1ebd517 commit 00dae00

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"build": {
3+
"dockerfile": "./Dockerfile",
4+
"context": "../conda"
5+
},
6+
"postCreateCommand": {
7+
"vscode": "mkdir ${containerWorkspaceFolder}/.vscode && cp ${containerWorkspaceFolder}/.devcontainer/tasks.json ${containerWorkspaceFolder}/.vscode/tasks.json"
8+
},
9+
"hostRequirements": {
10+
"cpus": 2
11+
},
12+
"customizations": {
13+
"codespaces": {
14+
"openFiles": ["README.md"]
15+
},
16+
"vscode": {
17+
"extensions": ["ms-toolsai.jupyter", "ms-python.python"]
18+
}
19+
}
20+
}

.devcontainer/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "jupyterlab",
6+
"type": "shell",
7+
"command": "/srv/conda/envs/notebook/bin/jupyter lab --LabApp.default_url='/lab/tree/overview/xarray-in-45-min.ipynb' --ServerApp.allow_origin='*' --no-browser",
8+
"presentation": {
9+
"reveal": "always"
10+
},
11+
"runOptions": {
12+
"runOn": "folderOpen"
13+
}
14+
}
15+
]
16+
}

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ Tutorials are written as interactive Jupyter Notebooks with executable code exam
1414

1515
All notebooks can be run via the Mybinder.org 'Launch Binder' badge at the top of this page. This will load a pre-configured JupyterLab interface with all tutorial notebooks for you to run. _You have minimal computing resources and any changes you make will not be saved._
1616

17+
#### Github Codespaces
18+
19+
This tutorial is available to run within [Github Codespaces](https://github.com/features/codespaces) - "a development environment that's hosted in the cloud" - with the conda environment specification in the [`conda-lock.yml`](../../conda/conda-lock.yml) file.
20+
21+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/xarray-contrib/xarray-tutorial/tree/main)
22+
23+
☝️ Click the button above to go to options window to launch a Github codespace.
24+
25+
A codespace is a development environment that's hosted in the cloud.
26+
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).**
27+
28+
Once your codespace is launched, the following happens:
29+
30+
- [Visual Studio Code](https://code.visualstudio.com/) Interface will open up within your browser.
31+
- A built in terminal will open and it will execute `jupyter lab` automatically.
32+
- Once you see a url to click within the terminal, simply `cmd + click` the given url.
33+
- This will open up another tab in your browser, leading to a [Jupyter Lab](https://jupyterlab.readthedocs.io/en/latest/) Interface.
34+
1735
#### Locally
1836

1937
You can also run these notebooks on your own computer! We recommend using [`micromamba`](https://mamba.readthedocs.io/en/latest/installation.html#micromamba) or [`conda-lock`](https://conda-incubator.github.io/conda-lock/) to ensure a fully reproducible Python environment:

0 commit comments

Comments
 (0)