Skip to content

Commit 0c582c7

Browse files
lsetiawanpre-commit-ci[bot]scottyhq
authored
Add codespace config for scipy 2023 (#184)
* Initial setup for codespaces * Change build context * Add apt.txt * Add jupyter and python extensions for vscode * Modify cpu requirement to 2 * Remove apt.txt, don't need it * Open README.md by default on vscode * Move codespaces to scipy 2023 and add apt txt for git and vim * Move all to .binder and add jupyterlab config * Fix context * Remove jupyter lab config default url settings * Remove jb config.. doesn't quite work * Move configs to conda/binder * Moving out of binder folder in conda * Move config and try postCreateCommand * Add create .jupyter folder * Change to post create and copy lab config only * Add small readme * Remove unecessary jupyter lab config * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix misspelling of jupyterlab * Try to use tasks and predefined vars * Modify the paths to directories * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove comments in tasks.json * Update readme to reflect recent changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove leading / * Add dependabot to auto update dockerfile image version * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Point to specific jupyter in conda * Allow all origins to avoid CORS * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update .devcontainer/scipy2023/tasks.json Co-authored-by: Scott Henderson <scottyhq@gmail.com> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Scott Henderson <scottyhq@gmail.com>
1 parent 9fcf914 commit 0c582c7

File tree

7 files changed

+81
-0
lines changed

7 files changed

+81
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM pangeo/base-image:2023.06.20
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"build": {
3+
"dockerfile": "../Dockerfile",
4+
"context": "../../conda"
5+
},
6+
"postCreateCommand": {
7+
"jupyterlab": "mkdir /home/jovyan/.jupyter && cp ${containerWorkspaceFolder}/.devcontainer/scipy2023/jupyter_lab_config.py /home/jovyan/.jupyter/jupyter_lab_config.py",
8+
"vscode": "mkdir ${containerWorkspaceFolder}/.vscode && cp ${containerWorkspaceFolder}/.devcontainer/scipy2023/tasks.json ${containerWorkspaceFolder}/.vscode/tasks.json"
9+
},
10+
"hostRequirements": {
11+
"cpus": 2
12+
},
13+
"customizations": {
14+
"codespaces": {
15+
"openFiles": ["workshops/scipy2023/README.md"]
16+
},
17+
"vscode": {
18+
"extensions": ["ms-toolsai.jupyter", "ms-python.python"]
19+
}
20+
}
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Configuration file for lab.
2+
3+
c = get_config() # noqa
4+
5+
## The default URL to redirect to from `/`
6+
# Default: '/lab'
7+
c.LabApp.default_url = '/lab/tree/workshops/scipy2023/index.ipynb'
8+
9+
## Set the Access-Control-Allow-Origin header
10+
#
11+
# Use '*' to allow any origin to access your server.
12+
#
13+
# Takes precedence over allow_origin_pat.
14+
# Default: ''
15+
c.ServerApp.allow_origin = '*'

.devcontainer/scipy2023/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 --no-browser",
8+
"presentation": {
9+
"reveal": "always"
10+
},
11+
"runOptions": {
12+
"runOn": "folderOpen"
13+
}
14+
}
15+
]
16+
}

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'docker'
4+
directory: '/.devcontainer'
5+
schedule:
6+
interval: 'daily'

conda/apt.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
git
2+
vim

workshops/scipy2023/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ See instructions to set up the environment for running the tutorial material [he
1919
For the live tutorial, we will be using the SciPy 2023 Nebari JupyterHub. Instructions for the live
2020
tutorial will be added soon.
2121

22+
## Github Codespaces
23+
24+
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.
25+
26+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new/xarray-contrib/xarray-tutorial/tree/main?devcontainer_path=.devcontainer%2Fscipy2023%2Fdevcontainer.json)
27+
28+
☝️ Click the button above to go to options window to launch a Github codespace.
29+
30+
A codespace is a development environment that's hosted in the cloud.
31+
You can choose from a selection of virtual machine types: 2 cores - 4 GB RAM - 32 GB storage, and 4 cores - 8 GB RAM - 32GB storage.
32+
Additionally, you are able to chose from various Dev container configuration, for this specific workshop, please ensure that `Scipy2023` is selected.
33+
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).**
34+
35+
Once your codespace is launched, the following happens:
36+
37+
- [Visual Studio Code](https://code.visualstudio.com/) Interface will open up within your browser.
38+
- A built in terminal will open and it will execute `jupyter lab` automatically.
39+
- Once you see a url to click within the terminal, simply `cmd + click` the given url.
40+
- This will open up another tab in your browser, leading to a [Jupyter Lab](https://jupyterlab.readthedocs.io/en/latest/) Interface.
41+
2242
## Outline
2343

2444
**🏗️ Outline coming soon! Please check back later**

0 commit comments

Comments
 (0)