Skip to content

Commit

Permalink
Merge branch 'main' into apply-ufunc-reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Jun 26, 2023
2 parents 748eab0 + f019704 commit f961e0e
Show file tree
Hide file tree
Showing 16 changed files with 2,515 additions and 3,237 deletions.
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"
}
}
]
}
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: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
contents: write
pages: write
id-token: write

Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: PR Preview

on: [pull_request]

permissions:
pull-requests: write # allow surge-preview to create/update PR comments

jobs:
preview:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup JupyterBook Cache
uses: actions/cache@v3
with:
path: _build
# NOTE: change key to "jupyterbook-DATE" to force rebuilding cache
key: jupyterbook-20230613

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/conda-lock.yml
environment-name: xarray-tutorial
cache-environment: true

- name: Build JupyterBook
# NOTE: login shell activates conda environment
shell: bash -l {0}
run: |
jupyter-book build ./ --warningiserror --keep-going
- name: Dump Build Logs
if: always()
run: |
if (test -a _build/html/reports/*log); then cat _build/html/reports/*log ; fi
- name: Publish to Surge
id: preview_step
uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: _build/html
build: |
npm install surge
- name: Format preview url
id: format_url
run: |
echo "url_text=:rocket: Preview deployed at https://${{ steps.preview_step.outputs.preview_url }}" >> $GITHUB_OUTPUT
- name: Get the preview_url
run: echo "${{ steps.format_url.outputs.url_text }}"

- name: Generate summary
run: |
echo "#### ${{ steps.format_url.outputs.url_text }}" >> $GITHUB_STEP_SUMMARY
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ All notebooks can be run via the Mybinder.org 'Launch Binder' badge at the top o

#### Locally

You can also run these notebooks on your own computer! We recommend using [`conda-lock`](https://conda-incubator.github.io/conda-lock/) to ensure a fully reproducible Python environment:
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:

```bash
git clone https://github.com/xarray-contrib/xarray-tutorial.git
cd xarray-tutorial

conda-lock install conda/conda-lock.yml --name xarray-tutorial
# Or `micromamba create -n xarray-tutorial -f conda-lock.yml`
# Or latest package versions: `mamba env create -f conda/environment-unpinned.yml`

conda activate xarray-tutorial
Expand Down
2 changes: 1 addition & 1 deletion conda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ conda-lock lock --mamba -f environment-unpinned.yml -p osx-64 -p linux-64 -p win
## Render a mybinder.org compatible environment.yml (linux-64)

```
conda-lock render -k env
conda-lock render -k env -p linux-64
mv conda-linux-64.lock.yml environment.yml
```

Expand Down
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
Loading

0 comments on commit f961e0e

Please sign in to comment.