-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from danielballan/restructure
Apply toolchain developed in interactive-tutorial-demo
- Loading branch information
Showing
24 changed files
with
5,271 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# GitHub syntax highlighting | ||
pixi.lock linguist-language=YAML linguist-generated=true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 5 * * 1' | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
build: | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
name: Build Jupyter Notebooks and HTML | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup GitHub Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Setup pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
cache: true | ||
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | ||
|
||
- name: Build executed notebooks and HTML | ||
run: pixi run build | ||
|
||
- name: Upload executed notebooks as GitHub artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: executed-notebooks | ||
path: build/jupyter_execute/recipes | ||
if-no-files-found: error | ||
|
||
- name: Prepare for Jupyter Lite | ||
run: | | ||
cp README.md docs/recipes/ | ||
# Convert Jupytext to ipynb format. | ||
pixi run ./convert_all.sh ipynb | ||
- name: Build Jupyter Lite | ||
run: pixi run -e jupyterlite jupyter lite build --contents docs/recipes --output-dir build/html/jupyterlite | ||
|
||
- name: Upload HTML as GitHub artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: build/html | ||
|
||
deploy-gh-pages: | ||
name: Deploy HTML to GitHub Pages | ||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy HTML to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
|
||
deploy-notebooks: | ||
name: Push to 'notebooks' branch ipynb-formatted version | ||
# Sets permissions of the GITHUB_TOKEN to allow pushing to 'notebooks' branch | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup pixi | ||
uses: prefix-dev/[email protected] | ||
|
||
- name: Publish ipynb-formatted variant to 'notebooks' branch of this repo | ||
run: | | ||
git fetch origin | ||
git checkout -B notebooks | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
pixi run ./convert_all.sh ipynb | ||
git add . | ||
git commit -am "Convert jupytext to ipynb format" | ||
git push origin notebooks --force-with-lease |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Test notebooks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 5 * * 1' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test all executable examples | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup pixi | ||
uses: prefix-dev/[email protected] | ||
|
||
- name: Test all files | ||
run: pixi run ./test.sh --all |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,7 @@ lockfiles/ | |
|
||
# ruff cache | ||
.ruff_cache/ | ||
|
||
/build/* | ||
.ipynb_checkpoints | ||
/.pixi/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
# bluesky-cookbook | ||
|
||
Documentation for various use cases, ideas and "recipes" within the bluesky framework | ||
Documentation for various use cases, ideas and "recipes" within the bluesky ecosystem | ||
|
||
See it live [here](http://blueskyproject.io/bluesky-cookbook/)! | ||
|
||
Each recipe should: | ||
|
||
* Be self contained | ||
* Include a list of "ingredients" i.e. which parts of the bluesky framework you need and what data you need | ||
* Be a markdown document | ||
* Be categorised as a [tutorial or how-to guide](https://diataxis.fr/) | ||
* Tagged | ||
* User | ||
* Developer | ||
* Admin | ||
* Manager | ||
|
||
## How to Build | ||
|
||
```bash | ||
pip install nox | ||
nox -s docs | ||
``` | ||
See it live at [blueskyproject.io/bluesky-cookbook](http://blueskyproject.io/bluesky-cookbook/)! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# If no arguments were provided, exit with error and show usage. | ||
if [ $# -eq 0 ]; then | ||
echo "Usage: $0 md | ipynb " >&2 | ||
exit 1 | ||
fi | ||
|
||
# Variable to track if any errors occur | ||
error_occurred=0 | ||
|
||
if [ "$1" = "ipynb" ]; then | ||
files=$(find docs/recipes/ -name "*.md" | grep -v .ipynb_checkpoints) | ||
for file in $files; do | ||
# Extract the kernel information from the Jupytext Markdown file | ||
kernel_info=$(grep -A 10 '^---$' "$file" | grep -E 'kernelspec') | ||
# Skip if no kernel information was found | ||
if [ -z "$kernel_info" ]; then | ||
continue | ||
fi | ||
jupytext --to ipynb "$file" && rm "$file" | ||
if [ $? -ne 0 ]; then | ||
error_occurred=1 | ||
echo "Errors when converting $file" | ||
else | ||
echo "Converted $file" | ||
fi | ||
done | ||
elif [ "$1" = "md" ]; then | ||
files=$(find docs/recipes/ -name "*.ipynb" | grep -v .ipynb_checkpoints) | ||
for file in $files; do | ||
jupytext --to markdown "$file" && rm "$file" | ||
if [ $? -ne 0 ]; then | ||
error_occurred=1 | ||
echo "Errors when converting $file" | ||
else | ||
echo "Converted $file" | ||
fi | ||
done | ||
fi | ||
|
||
if [ $error_occurred -ne 0 ]; then | ||
echo "Some files failed to convert." >&2 | ||
exit 1 | ||
else | ||
echo "All files converted successfully." >&2 | ||
exit 0 | ||
fi | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.