Skip to content

Add codespace config for scipy 2023 #184

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 36 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9012ac2
Initial setup for codespaces
lsetiawan Jun 22, 2023
45714b1
Change build context
lsetiawan Jun 22, 2023
bfb6c67
Add apt.txt
lsetiawan Jun 22, 2023
f6c04c5
Add jupyter and python extensions for vscode
lsetiawan Jun 22, 2023
290caee
Modify cpu requirement to 2
lsetiawan Jun 22, 2023
6d0ad47
Remove apt.txt, don't need it
lsetiawan Jun 22, 2023
7bd28fa
Open README.md by default on vscode
lsetiawan Jun 22, 2023
6be8ecb
Move codespaces to scipy 2023 and add apt txt for git and vim
lsetiawan Jun 22, 2023
ea3e21c
Move all to .binder and add jupyterlab config
lsetiawan Jun 22, 2023
7cda838
Fix context
lsetiawan Jun 22, 2023
179fe1f
Remove jupyter lab config default url settings
lsetiawan Jun 22, 2023
13bf341
Remove jb config.. doesn't quite work
lsetiawan Jun 22, 2023
eb57552
Move configs to conda/binder
lsetiawan Jun 22, 2023
c24b4d3
Moving out of binder folder in conda
lsetiawan Jun 22, 2023
d486c79
Move config and try postCreateCommand
lsetiawan Jun 22, 2023
02e53b8
Add create .jupyter folder
lsetiawan Jun 22, 2023
abee139
Change to post create and copy lab config only
lsetiawan Jun 23, 2023
44d6656
Add small readme
lsetiawan Jun 23, 2023
98e59b7
Remove unecessary jupyter lab config
lsetiawan Jun 23, 2023
389973f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
f36571f
Fix misspelling of jupyterlab
lsetiawan Jun 23, 2023
bfdf30e
Try to use tasks and predefined vars
lsetiawan Jun 23, 2023
a1ca440
Modify the paths to directories
lsetiawan Jun 23, 2023
e549551
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
b292498
Remove comments in tasks.json
lsetiawan Jun 23, 2023
4b7ebae
Update readme to reflect recent changes
lsetiawan Jun 23, 2023
f0f58ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
57f7596
Update README
lsetiawan Jun 23, 2023
477b403
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
9252985
Remove leading /
lsetiawan Jun 23, 2023
3da6dff
Add dependabot to auto update dockerfile image version
lsetiawan Jun 23, 2023
5b49dd8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
1ec923e
Point to specific jupyter in conda
lsetiawan Jun 23, 2023
3247b34
Allow all origins to avoid CORS
lsetiawan Jun 23, 2023
c9599f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
3f987f6
Update .devcontainer/scipy2023/tasks.json
lsetiawan Jun 23, 2023
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
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM pangeo/base-image:2023.06.20
21 changes: 21 additions & 0 deletions .devcontainer/scipy2023/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"build": {
"dockerfile": "../Dockerfile",
"context": "../../conda"
},
"postCreateCommand": {
"jupyterlab": "mkdir /home/jovyan/.jupyter && cp ${containerWorkspaceFolder}/.devcontainer/scipy2023/jupyter_lab_config.py /home/jovyan/.jupyter/jupyter_lab_config.py",
"vscode": "mkdir ${containerWorkspaceFolder}/.vscode && cp ${containerWorkspaceFolder}/.devcontainer/scipy2023/tasks.json ${containerWorkspaceFolder}/.vscode/tasks.json"
},
"hostRequirements": {
"cpus": 2
},
"customizations": {
"codespaces": {
"openFiles": ["workshops/scipy2023/README.md"]
},
"vscode": {
"extensions": ["ms-toolsai.jupyter", "ms-python.python"]
}
}
}
15 changes: 15 additions & 0 deletions .devcontainer/scipy2023/jupyter_lab_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Configuration file for lab.

c = get_config() # noqa

## The default URL to redirect to from `/`
# Default: '/lab'
c.LabApp.default_url = '/lab/tree/workshops/scipy2023/index.ipynb'

## Set the Access-Control-Allow-Origin header
#
# Use '*' to allow any origin to access your server.
#
# Takes precedence over allow_origin_pat.
# Default: ''
c.ServerApp.allow_origin = '*'
16 changes: 16 additions & 0 deletions .devcontainer/scipy2023/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "jupyterlab",
"type": "shell",
"command": "/srv/conda/envs/notebook/bin/jupyter lab --no-browser",
"presentation": {
"reveal": "always"
},
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will now open up another terminal and run jupyter lab as soon as the codespaces open, so user would only need to cmd + click the link.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'docker'
directory: '/.devcontainer'
schedule:
interval: 'daily'
2 changes: 2 additions & 0 deletions conda/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git
vim
20 changes: 20 additions & 0 deletions workshops/scipy2023/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ See instructions to set up the environment for running the tutorial material [he
For the live tutorial, we will be using the SciPy 2023 Nebari JupyterHub. Instructions for the live
tutorial will be added soon.

## Github Codespaces

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.

[![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)

☝️ Click the button above to go to options window to launch a Github codespace.

A codespace is a development environment that's hosted in the cloud.
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.
Additionally, you are able to chose from various Dev container configuration, for this specific workshop, please ensure that `Scipy2023` is selected.
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:

- [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.

## Outline

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