From 7493d2db0f8533c9262297911f85fc476cde5d52 Mon Sep 17 00:00:00 2001 From: Timothy Middelkoop Date: Tue, 2 Nov 2021 21:17:00 +0000 Subject: [PATCH] Add Jupyter Build scripts and content is now root --- _toc.yml | 49 ------- build-book.sh | 9 ++ class-essentials-story 2.svg | 4 - CLASS-logo.png => content/CLASS-logo.png | Bin _config.yml => content/_config.yml | 5 +- content/_toc.yml | 49 +++++++ .../class-essentials-story.svg | 0 .../essentials_arc.svg | 0 intro.md => content/intro.md | 0 logo.png => content/logo.png | Bin opendata.png => content/opendata.png | Bin references.bib => content/references.bib | 0 markdown.md | 125 ------------------ preview-book.sh | 4 + push-book.sh | 20 +++ requirements.txt | 1 + 16 files changed, 87 insertions(+), 179 deletions(-) delete mode 100644 _toc.yml create mode 100755 build-book.sh delete mode 100644 class-essentials-story 2.svg rename CLASS-logo.png => content/CLASS-logo.png (100%) rename _config.yml => content/_config.yml (92%) create mode 100644 content/_toc.yml rename class-essentials-story.svg => content/class-essentials-story.svg (100%) rename essentials_arc.svg => content/essentials_arc.svg (100%) rename intro.md => content/intro.md (100%) rename logo.png => content/logo.png (100%) rename opendata.png => content/opendata.png (100%) rename references.bib => content/references.bib (100%) delete mode 100644 markdown.md create mode 100644 preview-book.sh create mode 100755 push-book.sh diff --git a/_toc.yml b/_toc.yml deleted file mode 100644 index 14145c6..0000000 --- a/_toc.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Table of contents -# Learn more at https://jupyterbook.org/customize/toc.html - -format: jb-book -root: intro - -parts: - - caption: Introduction - chapters: - - file: content/intro_to_cloud - - - caption: CLASS Essentials Modules - chapters: - - file: content/AWS/intro_to_AWS_Essentials - sections: - - file: content/AWS/01_intro_to_cloud_console - - file: content/AWS/02_intro_to_compute_part1 - - file: content/AWS/03_intro_to_compute_part2 - - file: content/AWS/04_intro_to_cli - - file: content/AWS/05_intro_to_cloud_storage - - file: content/AWS/06_running_analysis - - file: content/AWS/07_monitoring_costs - - file: content/AWS/08_cleaning_up_resources - - - file: content/Azure/intro_to_Azure_Essentials - sections: - - file: content/Azure/01_intro_to_cloud_console - - file: content/Azure/02_intro_to_compute_part1 - - file: content/Azure/03_intro_to_compute_part2 - - file: content/Azure/04_intro_to_cli - - file: content/Azure/05_intro_to_cloud_storage - - file: content/Azure/06_running_analysis - - file: content/Azure/07_monitoring_costs - - file: content/Azure/08_cleaning_up_resources - - - file: content/GCP/intro_to_GCP_Essentials - sections: - - file: content/GCP/01_intro_to_cloud_console - - file: content/GCP/02_intro_to_cloud_compute_part1 - - file: content/GCP/03_intro_to_cloud_compute_part2 - - file: content/GCP/04_intro_to_cli - - file: content/GCP/05_intro_to_cloud_storage - - file: content/GCP/06_running_analysis - - file: content/GCP/07_monitoring_costs - - file: content/GCP/08_cleaning_up_resources - - - caption: Extra Learning Materials - chapters: - - file: content/ELM/01_bash_shell diff --git a/build-book.sh b/build-book.sh new file mode 100755 index 0000000..d2a5800 --- /dev/null +++ b/build-book.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +python3 -m venv .venv + +. .venv/bin/activate +python3 -m pip install --upgrade pip +python3 -m pip install -U jupyter-book sphinx_inline_tabs + +jupyter-book build content/ diff --git a/class-essentials-story 2.svg b/class-essentials-story 2.svg deleted file mode 100644 index 6ccad73..0000000 --- a/class-essentials-story 2.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -
CLOUD ACCOUNT
CLOUD A...
Log in to console
Log in to console
Provision a VM
Provision a VM
Compute types
& size
Compute types...
COMPUTE
COMPUTE
VPC/VNet
VPC/VNet
Subnets, Elastic IP, Ports
Subnets, Elastic IP,...
List of services
List of services
Projects, Resource Groups
Projects, Resource G...
IAM
IAM
Tagging
Tagging
Persistent Disks
Persistent Disks
Create a Storage Bucket
Create a Storage Buc...
Cloud CLI
Cloud CLI
STORAGE
STORAGE
Use CLI to manipulate bucket
Use CLI to manipulat...
Run a Python Script
Run a Python Script
Learn to install Miniconda
Learn to install Min...
ANALYSIS
ANALYS...
Access data on the cloud
Access data on the c...
Shut Down Resources
Shut Down Resources
Cost monitoring
Cost monitoring
CLEAN UP
CLEAN...
Best Practices
Best Practices
CLASS ESSENTIALS STORY ARC
CLASS ESSENTIALS STORY ARC
Learner
Lear...
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/CLASS-logo.png b/content/CLASS-logo.png similarity index 100% rename from CLASS-logo.png rename to content/CLASS-logo.png diff --git a/_config.yml b/content/_config.yml similarity index 92% rename from _config.yml rename to content/_config.yml index 1206902..fc1ed47 100644 --- a/_config.yml +++ b/content/_config.yml @@ -8,7 +8,10 @@ logo: CLASS-logo.png # Force re-execution of notebooks on each build. # See https://jupyterbook.org/content/execute.html execute: - execute_notebooks: force + execute_notebooks: off + +# Ignore build, git, and dev folders. +exclude_patterns: [ _build, .git, .venv, .ipynb_checkpoints, .vscode ] # Define the name of the latex output file for PDF builds latex: diff --git a/content/_toc.yml b/content/_toc.yml new file mode 100644 index 0000000..fc2c14e --- /dev/null +++ b/content/_toc.yml @@ -0,0 +1,49 @@ +# Table of contents +# Learn more at https://jupyterbook.org/customize/toc.html + +format: jb-book +root: intro + +parts: + - caption: Introduction + chapters: + - file: intro_to_cloud + + - caption: CLASS Essentials Modules + chapters: + - file: AWS/intro_to_AWS_Essentials + sections: + - file: AWS/01_intro_to_cloud_console + - file: AWS/02_intro_to_compute_part1 + - file: AWS/03_intro_to_compute_part2 + - file: AWS/04_intro_to_cli + - file: AWS/05_intro_to_cloud_storage + - file: AWS/06_running_analysis + - file: AWS/07_monitoring_costs + - file: AWS/08_cleaning_up_resources + + - file: Azure/intro_to_Azure_Essentials + sections: + - file: Azure/01_intro_to_cloud_console + - file: Azure/02_intro_to_compute_part1 + - file: Azure/03_intro_to_compute_part2 + - file: Azure/04_intro_to_cli + - file: Azure/05_intro_to_cloud_storage + - file: Azure/06_running_analysis + - file: Azure/07_monitoring_costs + - file: Azure/08_cleaning_up_resources + + - file: GCP/intro_to_GCP_Essentials + sections: + - file: GCP/01_intro_to_cloud_console + - file: GCP/02_intro_to_cloud_compute_part1 + - file: GCP/03_intro_to_cloud_compute_part2 + - file: GCP/04_intro_to_cli + - file: GCP/05_intro_to_cloud_storage + - file: GCP/06_running_analysis + - file: GCP/07_monitoring_costs + - file: GCP/08_cleaning_up_resources + + - caption: Extra Learning Materials + chapters: + - file: ELM/01_bash_shell diff --git a/class-essentials-story.svg b/content/class-essentials-story.svg similarity index 100% rename from class-essentials-story.svg rename to content/class-essentials-story.svg diff --git a/essentials_arc.svg b/content/essentials_arc.svg similarity index 100% rename from essentials_arc.svg rename to content/essentials_arc.svg diff --git a/intro.md b/content/intro.md similarity index 100% rename from intro.md rename to content/intro.md diff --git a/logo.png b/content/logo.png similarity index 100% rename from logo.png rename to content/logo.png diff --git a/opendata.png b/content/opendata.png similarity index 100% rename from opendata.png rename to content/opendata.png diff --git a/references.bib b/content/references.bib similarity index 100% rename from references.bib rename to content/references.bib diff --git a/markdown.md b/markdown.md deleted file mode 100644 index 5d5ae76..0000000 --- a/markdown.md +++ /dev/null @@ -1,125 +0,0 @@ -# Markdown Files - -Whether you write your book's content in Jupyter Notebooks (`.ipynb`) or -in regular markdown files (`.md`), you'll write in the same flavor of markdown -called **MyST Markdown**. - -## What is MyST? - -MyST stands for "Markedly Structured Text". It -is a slight variation on a flavor of markdown called "CommonMark" markdown, -with small syntax extensions to allow you to write **roles** and **directives** -in the Sphinx ecosystem. - -## What are roles and directives? - -Roles and directives are two of the most powerful tools in Jupyter Book. They -are kind of like functions, but written in a markup language. They both -serve a similar purpose, but **roles are written in one line**, whereas -**directives span many lines**. They both accept different kinds of inputs, -and what they do with those inputs depends on the specific role or directive -that is being called. - -### Using a directive - -At its simplest, you can insert a directive into your book's content like so: - -```` -```{mydirectivename} -My directive content -``` -```` - -This will only work if a directive with name `mydirectivename` already exists -(which it doesn't). There are many pre-defined directives associated with -Jupyter Book. For example, to insert a note box into your content, you can -use the following directive: - -```` -```{note} -Here is a note -``` -```` - -This results in: - -```{note} -Here is a note -``` - -In your built book. - -For more information on writing directives, see the -[MyST documentation](https://myst-parser.readthedocs.io/). - - -### Using a role - -Roles are very similar to directives, but they are less-complex and written -entirely on one line. You can insert a role into your book's content with -this pattern: - -``` -Some content {rolename}`and here is my role's content!` -``` - -Again, roles will only work if `rolename` is a valid role's name. For example, -the `doc` role can be used to refer to another page in your book. You can -refer directly to another page by its relative path. For example, the -role syntax `` {doc}`intro` `` will result in: {doc}`intro`. - -For more information on writing roles, see the -[MyST documentation](https://myst-parser.readthedocs.io/). - - -### Adding a citation - -You can also cite references that are stored in a `bibtex` file. For example, -the following syntax: `` {cite}`holdgraf_evidence_2014` `` will render like -this: {cite}`holdgraf_evidence_2014`. - -Moreover, you can insert a bibliography into your page with this syntax: -The `{bibliography}` directive must be used for all the `{cite}` roles to -render properly. -For example, if the references for your book are stored in `references.bib`, -then the bibliography is inserted with: - -```` -```{bibliography} -``` -```` - -Resulting in a rendered bibliography that looks like: - -```{bibliography} -``` - - -### Executing code in your markdown files - -If you'd like to include computational content inside these markdown files, -you can use MyST Markdown to define cells that will be executed when your -book is built. Jupyter Book uses *jupytext* to do this. - -First, add Jupytext metadata to the file. For example, to add Jupytext metadata -to this markdown page, run this command: - -``` -jupyter-book myst init markdown.md -``` - -Once a markdown file has Jupytext metadata in it, you can add the following -directive to run the code at build time: - -```` -```{code-cell} -print("Here is some code to execute") -``` -```` - -When your book is built, the contents of any `{code-cell}` blocks will be -executed with your default Jupyter kernel, and their outputs will be displayed -in-line with the rest of your content. - -For more information about executing computational content with Jupyter Book, -see [The MyST-NB documentation](https://myst-nb.readthedocs.io/). diff --git a/preview-book.sh b/preview-book.sh new file mode 100644 index 0000000..454f507 --- /dev/null +++ b/preview-book.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Preview html in Visual Studio Code or Cloud Shell preview +python3 -m http.server --directory content/_build/html 8080 diff --git a/push-book.sh b/push-book.sh new file mode 100755 index 0000000..b659edf --- /dev/null +++ b/push-book.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Set origin to $1 with a default of "private" +ORIGIN="${1:-private}" +echo "push-book.sh ORIGIN:${ORIGIN}" + +BRANCH=$(git symbolic-ref --short HEAD) +git branch -D gh-pages +git checkout -b gh-pages + +rm -rf docs/ +cp -av content/_build/html/ docs/ +touch docs/.nojekyll ## config static + +git add docs/ +git commit -m "Publish Jupyerbook" docs/ + +git push --force ${ORIGIN} gh-pages + +git checkout ${BRANCH} diff --git a/requirements.txt b/requirements.txt index 7e821e4..141408f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ jupyter-book +sphinx_inline_tabs matplotlib numpy