mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-12 22:35:51 +00:00
commit
a51764237d
34 changed files with 670 additions and 132 deletions
|
|
@ -42,23 +42,16 @@ parts:
|
|||
- caption: Features
|
||||
chapters:
|
||||
- file: features/overview.md
|
||||
- file: basic-features/overview.md
|
||||
sections:
|
||||
- file: basic-features/jupyterbook.md
|
||||
- file: basic-features/figures.md
|
||||
- file: basic-features/equations.md
|
||||
- file: basic-features/videos.md
|
||||
- file: basic-features/References.md
|
||||
- file: basic-features/code.md
|
||||
- file: basic-features/Code_block_figures
|
||||
- file: basic-features/badges.md
|
||||
- file: basic-features/banner
|
||||
title: Banner or Announcement
|
||||
- file: features/teachbooks_intro.md
|
||||
- file: external/deploy-book-workflow/README.md
|
||||
- file: features/favourites.md
|
||||
- file: external/template/README.md
|
||||
- file: features/easy-editing.md
|
||||
sections:
|
||||
- file: external/template/README.md
|
||||
- file: features/write_online.md
|
||||
- file: features/release_book_online.md
|
||||
- file: features/draft-release
|
||||
- file: external/deploy-book-workflow/README.md
|
||||
- file: features/pull_request_build.md
|
||||
- file: features/local_server
|
||||
- file: features/external_toc
|
||||
|
|
@ -91,7 +84,9 @@ parts:
|
|||
- file: external/Sphinx-PRIME-applets/README.md
|
||||
- external: https://github.com/TeachBooks/Sphinx-Dropdown-Toggle/blob/main/MANUAL.md
|
||||
- external: "https://github.com/TeachBooks/sphinx-code-examples/blob/main/MANUAL.ipynb"
|
||||
- file: features/sphinx-proof.md
|
||||
- external: "https://github.com/TeachBooks/Sphinx-NB-Execution-Patterns/blob/Manual/README.md"
|
||||
- file: features/exercise.md
|
||||
- file: features/visuals.md
|
||||
sections:
|
||||
- external: https://github.com/TeachBooks/Sphinx-Accessibility/blob/manual/README.md
|
||||
|
|
@ -106,17 +101,31 @@ parts:
|
|||
sections:
|
||||
- file: external/annotater/README.md
|
||||
- file: basic-features/hypothesis.md
|
||||
|
||||
- caption: Original Jupyter Book and Sphinx Features
|
||||
chapters:
|
||||
- file: basic-features/overview.md
|
||||
sections:
|
||||
- file: basic-features/jupyterbook.md
|
||||
- file: basic-features/figures.md
|
||||
- file: basic-features/equations.md
|
||||
- file: basic-features/videos.md
|
||||
- file: basic-features/References.md
|
||||
- file: basic-features/code.md
|
||||
- file: basic-features/Code_block_figures
|
||||
- file: basic-features/badges.md
|
||||
- file: basic-features/banner
|
||||
title: Banner or Announcement
|
||||
- caption: Examples
|
||||
chapters:
|
||||
- file: examples/overview.md
|
||||
- file: examples/book_structure.md
|
||||
- file: examples/live_code.md
|
||||
- file: examples/example_gumbel.ipynb
|
||||
- file: examples/theory_questions.md
|
||||
- file: examples/example_quiz_interactive.ipynb
|
||||
- file: examples/coding_theory_widgets.ipynb
|
||||
- file: examples/parametric_questions.ipynb
|
||||
sections:
|
||||
- file: examples/book_structure.md
|
||||
- file: examples/live_code.md
|
||||
- file: examples/example_gumbel.ipynb
|
||||
- file: examples/theory_questions.md
|
||||
- file: examples/example_quiz_interactive.ipynb
|
||||
- file: examples/coding_theory_widgets.ipynb
|
||||
- file: examples/parametric_questions.ipynb
|
||||
|
||||
- caption: Editing Tools
|
||||
chapters:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ This section is useful for [user type 3-5](../installation-and-setup/user_types.
|
|||
```
|
||||
````
|
||||
|
||||
# Original Jupyter Book and Sphinx Features
|
||||
# Overview
|
||||
|
||||
These pages will provide a list of some common, basic book features which are all available in the original <a href="https://jupyterbook.org/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="../images/logo-wide.svg" alt="Jupyter book"></a> package. Additionally, this page includes also best-practices.
|
||||
These pages itemize some of the more common, basic book features which are all available in the original <a href="https://jupyterbook.org/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="../images/logo-wide.svg" alt="Jupyter book"></a> package, without requiring any additional software. They are, of course, selected with teachers and teaching applications in mind. On each page best-practices are illustrated.
|
||||
|
|
|
|||
|
|
@ -66,6 +66,5 @@ The following pages contain content written by others, part of has been reused a
|
|||
- Page {ref}`copyright_licenses`: {numref}`Figure %s<fig_license_compatibility>` is included unmodified. Work is provided by Kennisland under a CC0 license. Accessed at [](https://wiki.creativecommons.org/wiki/File:CC_License_Compatibility_Chart.png) on December 17, 2024.
|
||||
- page [](./features/versioning.md): includes text from {cite:t}`semver` that has been modified. Original content licensed under CC BY 3.0.
|
||||
- page [](./features/external_toc.md): includes text from {cite:t}`teachbooks_package` that has been modified. Original content licensed under MIT.
|
||||
|
||||
|
||||
|
||||
- Page [](./features/exercise.md): includes text from {cite:t}`sphinx-exercise` that has been modified. Original content licensed under MIT license.
|
||||
- Page [](./features/sphinx-proof.md): includes text from {cite:t}`sphinx-proof` that has been modified. Original content licensed under MIT license.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
# TeachBooks Examples
|
||||
# Overview
|
||||
|
||||
This chapter will showcase some TeachBooks making great use of Jupyter Book and TeachBooks features. They can serve as an inspiring starting point for structuring your own TeachBook or just to get an idea of how other teachers and students are using it. Lastly some example pages are shown which combine theory and interactive questions and coding to different degrees.
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
2
book/external/Download-Link-Replacer
vendored
2
book/external/Download-Link-Replacer
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 10ff656dc4b871330dd2271d00d2e8b9a9a57613
|
||||
Subproject commit 89235af168099dfc6af2be6cab19ca9a5565e1c8
|
||||
2
book/external/JupyterBook-Patches
vendored
2
book/external/JupyterBook-Patches
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit eb505b3013d4019e01e448495e3eb1586f573a00
|
||||
Subproject commit fe2dd75143631d9b3d6501eb0294b94ba3348e3c
|
||||
2
book/external/Nested-Books
vendored
2
book/external/Nested-Books
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 943676969d6e42b9c6d9c25d5313d9c0fbceea97
|
||||
Subproject commit 97780fc7ad1ac36ba7079421a1326343c2488cfb
|
||||
2
book/external/Sphinx-Grasple-public
vendored
2
book/external/Sphinx-Grasple-public
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 9f6f68a8eaf28952c996fa3604f9201e7c40f271
|
||||
Subproject commit 2ca3894ef285f238cae1ba120ccf2c0f36e73b31
|
||||
2
book/external/Sphinx-Image-Inverter
vendored
2
book/external/Sphinx-Image-Inverter
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit eb21e6a80ed33f0102f9025b9ee983148370d753
|
||||
Subproject commit 215a5b9a8e205dba9ddf27052dba9e56d27c341e
|
||||
2
book/external/Sphinx-Named-Colors
vendored
2
book/external/Sphinx-Named-Colors
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 57ecdd887e8bbc32a04aca20e9fc9cb60409b7d0
|
||||
Subproject commit 1307f44c8d64fb98ce4649f585805666e90ec3aa
|
||||
2
book/external/Sphinx-PRIME-applets
vendored
2
book/external/Sphinx-PRIME-applets
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 14dc36bfdbf89d2d363ea2bdcbc30a64c0f7b00f
|
||||
Subproject commit 6217c862633bbbbce3365d9b121a7815a09f58a7
|
||||
2
book/external/Sphinx-TUDelft-theme
vendored
2
book/external/Sphinx-TUDelft-theme
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 2ab5d1d708aed595b9630c94081e05c11a84b18c
|
||||
Subproject commit 86f5772bedd64ccbb2ab9ab16577215803ef238c
|
||||
2
book/external/Sphinx-launch-buttons
vendored
2
book/external/Sphinx-launch-buttons
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit e6070ded6ca77662a3a951893cafe265fa333e5e
|
||||
Subproject commit 63d539763e9b9ce13f4dab2ef4c4a17c46e953ef
|
||||
2
book/external/Useful_python_code
vendored
2
book/external/Useful_python_code
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 81e923516e06441fb0c04f4946819f5dae9b0a68
|
||||
Subproject commit c80863d19f7fde7a452200baa4b4fafe12debc95
|
||||
2
book/external/deploy-book-workflow
vendored
2
book/external/deploy-book-workflow
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit ceb2bdbe9bed7d7d81ea7342c4bb93044f3879d5
|
||||
Subproject commit 65010c7dc0eff87eb4d7729ee251d0df221c44f8
|
||||
2
book/external/sphinx-iframes
vendored
2
book/external/sphinx-iframes
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 583163ebf970a83ff45d80bb9ace9922d1e1615b
|
||||
Subproject commit 69e6028e79a3e5aa521093155ee54201299630ff
|
||||
2
book/external/teachbooks-sphinx-tippy
vendored
2
book/external/teachbooks-sphinx-tippy
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit e4166e1389ab48ea9059e6576e56d270e66199dd
|
||||
Subproject commit 6122c67f86a7c9b95f349c80316571e277f0a66b
|
||||
2
book/external/template
vendored
2
book/external/template
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 8424c5e1fb5631474250859482b92fc1761c502f
|
||||
Subproject commit 5183c1616932c85a398e561124cf046288695101
|
||||
|
|
@ -5,6 +5,9 @@ This page is useful for user type 4 and 5.
|
|||
```
|
||||
|
||||
{bdg-primary}`(To be converted into) Sphinx Extension`
|
||||
{bdg-link-secondary}`Supported by TeachBooks package <./teachbooks_intro.html>`
|
||||
|
||||
|
||||
````
|
||||
|
||||
(apa)=
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
This page is useful for user type 3-5.
|
||||
```
|
||||
|
||||
{bdg-link-secondary}`Python Package: teachbooks <./overview#teachbooks-python-package>`
|
||||
{bdg-link-secondary}`Uses TeachBooks package <./teachbooks_intro.html>`
|
||||
{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`
|
||||
{bdg-link-light}`Supported by Deploy Book workflow <../external/deploy-book-workflow/README.html>`
|
||||
|
||||
````
|
||||
|
||||
|
|
|
|||
88
book/features/exercise.md
Normal file
88
book/features/exercise.md
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
````{margin}
|
||||
```{attributiongrey} Attribution
|
||||
:class: attribution
|
||||
This page reuses MIT licensed content from {cite:t}`sphinx-exercise`. {fa}`quote-left`{ref}`Find out more here.<external_resources>`
|
||||
```
|
||||
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 3-5.
|
||||
```
|
||||
+++
|
||||
{bdg-primary}`Sphinx Extension`
|
||||
{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`
|
||||
{bdg-link-primary-line}`Included in TeachBooks Favourites <./favourites.html>`
|
||||
````
|
||||
|
||||
# Sphinx exercise
|
||||
|
||||
This extensions provides an easy way to add exercises and solutions to your book. It is created by the Executable Books team and is [documented here](https://ebp-sphinx-exercise.readthedocs.io/en/latest/).
|
||||
|
||||
TeachBooks has made some small modifications to the original extension, such that it works well with translated books; this modified version is located in the repository [github.com/TeachBooks/sphinx-exercise](https://github.com/TeachBooks/sphinx-exercise).
|
||||
|
||||
## What does it do?
|
||||
|
||||
This extension defines exercises and solutions as new admonition types:
|
||||
|
||||
```{exercise}
|
||||
:label: my-exercise
|
||||
|
||||
Recall that $n!$ is read as "$n$ factorial" and defined as
|
||||
$n! = n \times (n - 1) \times \cdots \times 2 \times 1$.
|
||||
|
||||
There are functions to compute this in various modules, but let's
|
||||
write our own version as an exercise.
|
||||
|
||||
In particular, write a function `factorial` such that `factorial(n)` returns $n!$
|
||||
for any positive integer $n$.
|
||||
```
|
||||
|
||||
````{solution} my-exercise
|
||||
:label: my-solution
|
||||
|
||||
Here's one solution.
|
||||
|
||||
```{code-block} python
|
||||
def factorial(n):
|
||||
k = 1
|
||||
for i in range(n):
|
||||
k = k * (i + 1)
|
||||
return k
|
||||
|
||||
factorial(4)
|
||||
```
|
||||
````
|
||||
|
||||
More information can be found in the [official documentation](https://ebp-sphinx-exercise.readthedocs.io/en/latest/).
|
||||
|
||||
## Installation
|
||||
To use this extenstion, follow these steps:
|
||||
|
||||
**Step 1: Install the Package**
|
||||
|
||||
Install the TeachBooks' version of `sphinx-exercise` package using `pip`:
|
||||
```
|
||||
pip install sphinx-exercise @ git+https://github.com/TeachBooks/sphinx-exercise.git
|
||||
```
|
||||
|
||||
**Step 2: Add to `requirements.txt`**
|
||||
|
||||
Make sure that the package is included in your project's `requirements.txt` to track the dependency:
|
||||
```
|
||||
sphinx-exercise @ git+https://github.com/TeachBooks/sphinx-exercise.git
|
||||
```
|
||||
|
||||
**Step 3: Enable in `_config.yml`**
|
||||
|
||||
In your `_config.yml` file, add the extension to the list of Sphinx extra extensions (**important**: underscore, not dash this time):
|
||||
```
|
||||
sphinx:
|
||||
extra_extensions:
|
||||
.
|
||||
.
|
||||
.
|
||||
- sphinx_exercise
|
||||
.
|
||||
.
|
||||
.
|
||||
```
|
||||
|
|
@ -9,7 +9,7 @@ This page reuses MIT licensed content from {cite:t}`teachbooks_package`. {fa}`qu
|
|||
This page is useful for user type 3-5.
|
||||
```
|
||||
|
||||
{bdg-link-secondary}`Python Package: teachbooks <./overview#teachbooks-python-package>`
|
||||
{bdg-link-secondary}`Uses TeachBooks package <./teachbooks_intro.html>`
|
||||
|
||||
{bdg-success}`WebApp`
|
||||
````
|
||||
|
|
|
|||
75
book/features/favourites.md
Normal file
75
book/features/favourites.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
````{margin}
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This page is useful for user type 3-5.
|
||||
```
|
||||
|
||||
{bdg-primary}`Sphinx Extension`
|
||||
{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`
|
||||
|
||||
|
||||
````
|
||||
|
||||
# TeachBooks Favourites
|
||||
|
||||
TeachBooks Favourites is a Sphinx extension which collects all of TeachBooks' favourite features in one place (including tools originally by TeachBooks and from other sources). It is included by default in the [TeachBooks Template](../external/template/README.md) or can be installed independently. The features included are:
|
||||
|
||||
- [Sphinx-Thebe from TeachBooks](./live_code.ipynb)
|
||||
- [Jupyterbook patches](../external/JupyterBook-Patches/README.md)
|
||||
- [Download link replacer](../external/Download-Link-Replacer/README.md)
|
||||
- [Sphinx image inverter](../external/Sphinx-Image-Inverter/README.md)
|
||||
- [Sphinx iframes](../external/sphinx-iframes/README.md)
|
||||
- [Sphinx exercise (TeachBooks contribution to the original)](https://ebp-sphinx-exercise.readthedocs.io/en/latest/)
|
||||
- [Teachbooks Sphinx tippy](../external/teachbooks-sphinx-tippy/README.md)
|
||||
- [Sphinx named colors](../external/Sphinx-Named-Colors/README.md)
|
||||
- [Sphinx dropdown toggle](../_git/github.com_TeachBooks_Sphinx-Dropdown-Toggle/main/MANUAL.md)
|
||||
- [Sphinx proof (TeachBooks contribution to the original)](https://sphinx-proof.readthedocs.io/en/latest/)
|
||||
- [Sphinx code examples](../_git/github.com_TeachBooks_sphinx-code-examples/main/MANUAL.ipynb)
|
||||
- [Sphinx accessibility](../_git/github.com_TeachBooks_Sphinx-Accessibility/manual/README.md)
|
||||
- [Sphinx toggle button (TeachBooks contribution to the original)](https://sphinx-togglebutton.readthedocs.io/en/latest/)
|
||||
- [Notebook execution patterns](../_git/github.com_TeachBooks_Sphinx-NB-Execution-Patterns/Manual/README.md)
|
||||
- [Sphinx Launch Buttons](../external/Sphinx-launch-buttons/README.md)
|
||||
|
||||
All features which are part of TeachBooks Favourites are include the following label on their respective pages in this manual: {bdg-primary-line}`Part of TeachBooks Favourites`. If you'd like to use specific features, but not the entire TeachBooks Favourites, you can remove this extension and replace it with the individual extensions you want to use.
|
||||
|
||||
## Installation
|
||||
To install TeachBooks-Favourites, follow these steps:
|
||||
|
||||
**Step 1: Install the Package**
|
||||
|
||||
Install the `teachbooks-favourites` package using `pip`:
|
||||
```
|
||||
pip install git+https://github.com/TeachBooks/TeachBooks-Favourites
|
||||
```
|
||||
|
||||
**Step 2: Add to `requirements.txt`**
|
||||
|
||||
Make sure that the package is included in your project's `requirements.txt` to track the dependency:
|
||||
```
|
||||
git+https://github.com/TeachBooks/TeachBooks-Favourites
|
||||
```
|
||||
|
||||
**Step 3: Enable in `_config.yml`**
|
||||
|
||||
In your `_config.yml` file, add the extension to the list of Sphinx extra extensions (**important**: underscore, not dash this time):
|
||||
```
|
||||
sphinx:
|
||||
extra_extensions:
|
||||
- teachbooks_favourites
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
For using the various package we refer to the different manuals linked above.
|
||||
|
||||
All extensions are loaded with their default settings.
|
||||
|
||||
## Contribute
|
||||
|
||||
Do you think we missed an extension that should really be included? Let us know by either
|
||||
|
||||
- creating a fork of this repository and submitting a pull request, in which you added the extension to the files
|
||||
- `README.md`
|
||||
- `pyproject.toml`
|
||||
- `src\teachbooks_favourites\__init__.py`
|
||||
- opening an issue.
|
||||
|
|
@ -11,6 +11,9 @@
|
|||
"```\n",
|
||||
"\n",
|
||||
"{bdg-primary}`Sphinx Extension`\n",
|
||||
"{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`\n",
|
||||
"{bdg-link-primary-line}`Included in TeachBooks Favourites <./favourites.html>`\n",
|
||||
"\n",
|
||||
"```` \n",
|
||||
"\n",
|
||||
"# Interactive content: Run Python inside your book\n",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
This section is useful for user type 4-5.
|
||||
```
|
||||
|
||||
{bdg-link-secondary}`Python Package: teachbooks <./overview#teachbooks-python-package>`
|
||||
{bdg-link-secondary}`Uses TeachBooks package <./teachbooks_intro.html>`
|
||||
````
|
||||
|
||||
(setup-local-server)=
|
||||
|
|
|
|||
|
|
@ -4,96 +4,27 @@
|
|||
As TeachBooks, we collect a suite of existing open-source software so you don't have to! Some of the software is developed with our TA's to improve the learning experience of our students and ease the book-development process for our teachers. As the open-source software landscape changes rapidly, it is essential to keep in contact and share resources amongst ourselves to minimize maintenance and downtime for our book websites and focus on what really matters: teaching!
|
||||
|
||||
Since the list of TeachBook features is getting quite long, we have grouped them in categories:
|
||||
- Original Jupyter Book and Sphinx features
|
||||
- Easy editing process
|
||||
- Additional functionality
|
||||
- Book styling
|
||||
- TeachBooks student-view features
|
||||
- [Original Jupyter Book and Sphinx features](../basic-features/overview.md)
|
||||
- [Easy editing process](./easy-editing.md)
|
||||
- [Additional functionality](./sphinx_extensions.md)
|
||||
- [Book styling](./visuals.md)
|
||||
- [TeachBooks student-view features](./students.md)
|
||||
|
||||
Additionally, not all features are built and shared in the same way. We do our best to make sure that as many tools as possible are included automatically when using our TeachBooks Template Book; if you are not using the Template, we try to make sure each of our tools can be used independently. For transparency, tags will help differentiate between the different backgrounds of the features:
|
||||
- {bdg-warning}`Javascript overlay`
|
||||
- {bdg-success}`Chrome Extension`
|
||||
- {bdg-white}`GitHub App and Javascript script`
|
||||
- {bdg-link-secondary}`Python Package: teachbooks <./overview.html#teachbooks-python-package>`
|
||||
- {bdg-light}`GitHub Reusable Action`
|
||||
- {bdg-light}`GitHub Template`
|
||||
- {bdg-link-secondary}`Python Package: teachbooks <./teachbooks_intro.html>`
|
||||
- {bdg-link-light}`GitHub Reusable Action: Deploy Book workflow <../external/deploy-book-workflow/README.html>`
|
||||
- {bdg-link-light}`GitHub Template: TeachBooks Template <../external/template/README.html>`
|
||||
- {bdg-dark}`Git Workflow`
|
||||
- {bdg-primary}`Sphinx Extension`
|
||||
- {bdg-link-primary-line}`TeachBooks Favourites <./favourites.html>`
|
||||
- {bdg-danger}`iframe`
|
||||
- {bdg-success}`WebApp`
|
||||
|
||||
Finally, the purpose, installation process and usage of each features is elaborated on in the respective sub-sections.
|
||||
For each feature, the purpose, installation process and usage is elaborated in the respective sub-sections.
|
||||
|
||||
To see examples for these features, go to the [Examples chapter](../examples/overview.md).
|
||||
To see examples of these features, go to the [Examples chapter](../examples/overview.md).
|
||||
|
||||
As the TeachBooks Python Package and the Deploy Book Workflow are important tools that incorporate and deploy more than one feature, an additional explanation is provided on this page in more detail, with links to the pages in this manual where individual features are described.
|
||||
|
||||
(teachbooks_package)=
|
||||
## TeachBooks Python Package
|
||||
|
||||
````{margin}
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 4-5.
|
||||
```
|
||||
````
|
||||
|
||||
The TeachBooks Python package is a collection of tools that are used to enhance the Jupyter Book software package by adding features and making customization easier. In general, it is only of interest to user types 4 and 5 when building a book locally. However, it may be important for other users to know what the package does, as it is incorporated in the [Deploy Book Workflow](./deploy-book-workflow.md) and, therefore, any book created from the [TeachBooks Template](../external/template/README.md). This raises two important points:
|
||||
|
||||
1. If you are a book user using the [TeachBooks Template](../external/template/README.md) and/or the {ref}`Deploy Book Workflow <deploy-book-workflow-intro>`, your book is by default built with the `teachbooks` package, and the way your book is built and features that are included in the book may change automatically when it is updated (these will be non-breaking changes; if not, we will notify our mailing list).
|
||||
2. If you are using the `jupyter-book` package to build your book, some of the features described in this Manual may not be available to you (i.e., those listed on this page). This will be the case if you are using a [setup described in the Jupyter Book Manual](https://jupyterbook.org/en/stable/publish/web.html), for example, [this GitHub workflow](https://jupyterbook.org/en/stable/publish/gh-pages.html).
|
||||
|
||||
For those who wish to use the package, it is available on [PyPI](https://pypi.org/project/teachbooks/) and can be installed using `pip install teachbooks`. As `teachbooks` is a wrapper, the package is meant to replace the usage of `jupyter-book` commands (although it does indeed add a few new commands to the CLI, e.g., `serve`). It is conventionally used in an identical way, as follows:
|
||||
|
||||
```
|
||||
teachbooks build book
|
||||
```
|
||||
|
||||
This Manual describes the main features and usage of the package. For those who wish to understand more of hte technical details, note that the implementation the API is is documented at [teachbooks.readthedocs.io/](https://teachbooks.readthedocs.io/).
|
||||
|
||||
### List of Features
|
||||
|
||||
Items in the list here are currently implemented in the TeachBooks package and described on other pages of this manual:
|
||||
- [Draft-Release Workflow](./draft-release.md)
|
||||
- [External Contents](./external_toc.md)
|
||||
- [Local Server](./local_server.md)
|
||||
|
||||
The package is also set up to handle [APA references](./apa) when using the Draft-Release Workflow (the `_ext` subdirectory and its contents are manually copied during the pre-build phase). This will not be necessary once the APA Reference feature is turned into a proper Sphinx extension or Pybtext plugin.
|
||||
|
||||
(deploy-book-workflow-intro)=
|
||||
## Deploy Book Workflow
|
||||
|
||||
The [Deploy Book Workflow](../external/deploy-book-workflow/README.md) is by default incorporated into any book that has been created using the [TeachBooks Template](../external/template/README.md). We also strongly encourage anyone to consider this tool as an alternative to the "standard" workflow provided by Jupyter Book, as ours automatically builds a different version of your book for every branch in your respository, along with a number of settings that can be used to customize the build process and URL structure of your book(s). This tool is described in more detail on [the Deploy Book Workflow page of this manual](../external/deploy-book-workflow/README.md), and one should note that it influences a number of other aspects of a TeachBook.
|
||||
|
||||
### Related Features
|
||||
|
||||
A list of tools and features that are dependent on, or related to, the Deploy Book Workflow (DBW) is provided here:
|
||||
|
||||
Important for these features:
|
||||
- [](../external/deploy-book-workflow/README.md): the main DBW page
|
||||
- [](../external/template/README.md): books created from the Template include DBW by default
|
||||
- [](./draft-release.md): can be configured directly using the DBW
|
||||
- [](./update_env.md): behaviors of this tool may influence the DBW
|
||||
- {ref}`TeachBooks Python Package <teachbooks_package>`: included by default in the DBW
|
||||
- [](./pull_request_build.md): created to provide DBW-like behavior for PR's from forked repositories
|
||||
- [](./apa.md): a temporary fix is included in `teachbooks` to enable use in the DBW
|
||||
|
||||
### Book Build Commands
|
||||
|
||||
By default the DBW builds books using the following command:
|
||||
```
|
||||
teachbooks build book/
|
||||
```
|
||||
|
||||
To use the [Draft-Release Workflow](./draft-release.md) with the Deploy Book Workflow the `BRANCHES_TO_PREPROCESS` variable must be configured for a specific branch, which will then execute the following command:
|
||||
```
|
||||
teachbooks build --release book/
|
||||
```
|
||||
|
||||
### Environments and Caching
|
||||
|
||||
As described on the [DBW page](../external/deploy-book-workflow/README.md), there is a lot going on "under the hood" with regards to caching of GitHub Action artifacts. This can lead to undesired behavior when using the DBW, especially if package version numbers are not precisely defined. In general we expect the risk of this occurring to be low, as it should only happen when multiple branches are being actively used (new commits on each branch at least once per week), a package from the `requirements.txt` file is updated in the time between creation of two or more branches, and that package _also_ has a significant impact on the book building process. As the Python virtual environment cache is replaced by default if older than one week, the issue should resolve itself within that time frame.
|
||||
|
||||
Note that Specifying package version numbers explicitly and updating them via [Dependabot](./update_env.md) is an excellent way to ensure that environments in the DBW are always up to date and this issue is avoided.
|
||||
|
||||
If you are _not_ using Dependabot and are not able to get your packages updated when the DBW is running, delete the cache manually and rerun your GitHub Actions job (go to Actions tab, then looking for the "Caches" section under the "Management" pane on the left hand side of the screen).
|
||||
As the [TeachBooks Python Package](./teachbooks_intro.md), the [Deploy Book Workflow](../external/deploy-book-workflow/README.md), [TeachBooks Favourites](./favourites.md) and the [TeachBook template](../external/template/README.md) are important tools that incorporate and deploy more than one feature, an additional explanation is provided here in subpages to this page in more detail, with links to other pages in this manual where individual features are described.
|
||||
238
book/features/release_book_online.md
Normal file
238
book/features/release_book_online.md
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
````{margin}
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 3-5.
|
||||
```
|
||||
|
||||
{bdg-link-light}`GitHub Reusable Action: Deploy Book workflow <../external/deploy-book-workflow/README.html>`
|
||||
{bdg-link-light}`Part of TeachBooks Template <../external/template/README.html>`
|
||||
{bdg-link-secondary}`Uses TeachBooks package <./teachbooks_intro.html>`
|
||||
````
|
||||
|
||||
# Share book online for multiple versions
|
||||
|
||||
As you'll start working on your TeachBook, you'll probably want to share it online. And over time you'll create more and more versions of your book, for example for different academic years.
|
||||
|
||||
Our Deploy Book Workflow (described in general [here](../external/deploy-book-workflow/README.md)) allows you to do so. It builds your book for all branches in your repository and releases them online via GitHub Pages. In simplified terms, it automatically builds the book website based on updates to your repository, creates multiple instances of your book (defined by each branch) and provides the ability to customize the URL's at which each instance of the book can be accessed. This tool is designed specifically for educational contexts, for example, when you may want to preserve book versions from multiple academic years so that students are able to access it later.
|
||||
|
||||
Sharing your book online has many features and customizations:
|
||||
- Automatic and manual building and releasing of your book online via GitHub Pages using a Reusable GitHub Actions. See explanation [below](how_to_start).
|
||||
- Ability to release both private (GitHub Pro, GitHub Team, GitHub Enterprise Cloud, or GitHub Enterprise Server required) and public (GitHub Free is enough) repositories. GitHub Teams is free for teachers as described in the [GitHub documentation](https://docs.github.com/en/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-education-for-teachers/about-github-education-for-teachers#github-education-features-for-teachers). If you have an organization for your TeachBook on GitHub, link your GitHub team rights to your organization as described on the [GitHub website](https://github.com/team#organizations).
|
||||
- Releasing all or a selection of branches, allowing to build a draft version of the TeachBook online which reduces the need for local builds of the book. See explanation [below](gh-workflow-settings).
|
||||
- Allowing use of submodules within your book. For private submodules, see the explanation [below](private_submodules)
|
||||
- Converting branch-names to well-defined URLs. See explanation [below](gh-workflow-settings).
|
||||
- Customizable settings on where the books should be deployed including alias for branch-names and selection of one branch to be deployed on root. The workflow will gives warnings if these settings are ill-defined or conflicting. Although aliases are generally not allowed by GitHub Pages, it seems you can use one alias, but not more. See explanation [below](gh-workflow-settings).
|
||||
- Customizable behavior of book URL root directory, either by redirecting the root to one of the branches or by copying or moving one of the branches to root. See explanation [below](gh-workflow-settings).
|
||||
- Adds an 'archived'-banner to old branches / branches of previous years. See explanation [below](gh-workflow-settings).
|
||||
- Custom 404 "Page Not Found" page with buttons for redirecting to Homepage (e.g., book intro page), "Go Back" or Repository home.
|
||||
- Provides a summary describing where the TeachBook is released, errors in the build process per branch and how the release step is configured. See explanation [below](gh-workflow-summary)
|
||||
- Caching of already built books so that it can be partially reused when another branch is released or the next build contains critical errors. See explanation [below](gh-caching)
|
||||
- Caching of python environment to speed up the workflow. See explanation [below](gh-caching)
|
||||
|
||||
(how_to_start)=
|
||||
## How to start using this workflow
|
||||
|
||||
The Deploy Book Workflow is by default incorporated into any book that has been created using the [TeachBooks Template](https://github.com/TeachBooks/template).
|
||||
|
||||
Feel free to use it for your existing TeachBook as well:
|
||||
1. Add [`teachbooks`](https://github.com/TeachBooks/TeachBooks) to your `requirements.txt` file in your root folder
|
||||
2. Move all the TeachBook files (including `_config.yml` and `_toc.yml`) to a subdirectory `book/`.
|
||||
3. Copy the [`call-deploy-book.yml`](https://github.com/TeachBooks/template/blob/main/.github/workflows/call-deploy-book.yml) workflow to the `/.github/workflows` folder in your repository (the file is located in the TeachBooks Template repository becuase that file then refers to the file `deploy-book.yml` located in _this_ repository).
|
||||
4. Set source for GitHub pages to GitHub Actions under <svg aria-label="Edit repository metadata" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-gear float-right"> <path d="M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z"></path> </svg>`Settings` - <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-browser"> <path d="M0 2.75C0 1.784.784 1 1.75 1h12.5c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25ZM14.5 6h-13v7.25c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25Zm-6-3.5v2h6V2.75a.25.25 0 0 0-.25-.25ZM5 2.5v2h2v-2Zm-3.25 0a.25.25 0 0 0-.25.25V4.5h2v-2Z"></path> </svg> `Pages` - `Build and deployment` - `Source` - `GitHub Actions` (as long as you don't do this the workflow deploys all branches which build successfully).
|
||||
5. Trigger the workflow by making an edit to the TeachBook by editing and committing changes to one of the files in the `book/` subdirectory (available under <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> `Code`) or manually activating the workflow under <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions` - `All workflows` - `call-deploy-book` - `Run workflow` - `Use workflow from branch: <the branch you did step 1, 2 and 3 in>` - `Run workflow` (this workflow).
|
||||
6. Now checkout the progress and summary of the releasing workflow under <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions` - `All workflows` - `call-deploy-book` -`<the most recent workflow run>`.
|
||||
|
||||
(gh-workflow-settings)=
|
||||
## Customize the workflow: TeachBook releasing settings
|
||||
You can adapt the behaviour by setting repository variables as explained [here](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) or using the [VS Code Extension GitHub Actions](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions). Define the following repository variables:
|
||||
- `PRIMARY_BRANCH` which is set to `main` whenever it's not defined in the repository variables.
|
||||
- This sets the branch or alias (when using 'redirect' for `BEHAVIOR_PRIMARY`) which is shown on root.
|
||||
- It is advised to show either your default branch on root, or the branch shared with your primary/active book audience (e.g., your current students).
|
||||
- `BEHAVIOR_PRIMARY` which is set to `redirect` whenever it's not defined in the repository variables.
|
||||
- This indicates whether to copy the PRIMARY_BRANCH to root ('copy'), move the PRIMARY_BRANCH to root ('move') or redirect from root to the PRIMARY_BRANCH ('redirect')
|
||||
- Advised to use 'redirect' if you expect to archive a version in the future so that the URL doesn't change for the reader (e.g., to preserve URL containing the current academic year shared with students).
|
||||
- Use copy or move when you only expect readers to use the root URL. Move is useful to remove unnecessary build artifacts and if you don't need to visit the URL containing the branch or alias name.
|
||||
- `BRANCH_ALIASES` which is set to ` ` (just a space) whenever it's not defined in the repository variables.
|
||||
- This defines an alias (custom URL) for a branch
|
||||
- Variables should be a space-separated list of branch names, e.g. 'alias:really-long-branch-name`
|
||||
- If no alias is wanted, `BRANCH_ALIASES` may be set to ` ` (just a space)
|
||||
- `BRANCHES_TO_DEPLOY` which is set to `*` (all branches) whenever it's not defined in the repository variables.
|
||||
- This defines the branches to deploy.
|
||||
- It should be a space-separated list of branch names, e.g. 'main second third'.
|
||||
- `BRANCHES_TO_PREPROCESS` which is set to ` ` (just a space = no branch) whenever it's not defined in the repository variables
|
||||
- This defines the branches to preprocess with the [`TeachBooks` package](./draft-release.md), which removed book-pages and config lines defined with `# START REMOVE-FROM-RELEASE` and `# END REMOVE-FROM-RELEASE`
|
||||
- It should be a space-separated list of branch names, e.g. 'main second third'.
|
||||
- If no preprocessing is required, `BRANCH_TO_PREPROCESS` may be set to ' ' (space).
|
||||
- `BRANCHES_ARCHIVED` which is set to ` ` (space, no branch) whenever it's not defined in the repository variables
|
||||
- This adds a banner to the released branch: You are viewing an archived version of the book. Click here for the latest version.
|
||||
- It should be a space-separate list of branch names, e.g. 'main second third'.
|
||||
|
||||
In `call-deploy-book.yml` itself you can specify the trigger for this workflow. By default, a push to any branch triggers the workflow. You can limit the branches or subdirectories.
|
||||
|
||||
## Additional GitHub settings
|
||||
We advise you to enable two options in the general repository setting regarding pull requests in GitHub:
|
||||
- Enable `Always suggest updating pull request branches`, suggesting a merge from the default branch into any separate branch before merging into main.
|
||||
- Enable `Automatically delete head branches` to delete branches after they are merged (you'll still be able to restore those).
|
||||
|
||||
## Common Usage Examples
|
||||
|
||||
Relevant use cases are explained here, along with an explanation for how to set up the workflow accordingly. Note that it is not required to set your `PRIMARY_BRANCH` to the default branch of your GitHub repository; this is a choice that is determined by what version of the source code you want visitors to see (i.e., work in progress, or the most recent "complete" or "released" version of a book).
|
||||
|
||||
### Books with active users of different versions (academic years)
|
||||
|
||||
Consider a case where each academic year you would like to create a new book for your students. However, you need to ensure that students from previous years can still access "their" version of the book.
|
||||
|
||||
Assume for this example that we are working in the "my_organization" GitHub Organization in repository "my_book" and that the current academic year is 2025, and that we have one or more books in our repository from previous years. The desired URL structure is thus:
|
||||
- students from this year use the book at `my_organization.github.io/my_book/2025/`
|
||||
- students from last year use the book at `my_organization.github.io/my_book/2024/`
|
||||
- visitors to `my_organization.github.io/my_book/` will automatically be redirected to the book from the current year
|
||||
|
||||
To create this behavior, do the following:
|
||||
|
||||
- Create a branch for each year: a logical name would have format `YYYY`, (technically it can be anything, as the URL can be set to `YYYY` with `BRANCH_ALIASES`).
|
||||
- Set `PRIMARY_BRANCH` to the branch for the current academic year (e.g., `2025`)
|
||||
- Set `BEHAVIOR_PRIMARY` to `redirect` (default)
|
||||
|
||||
#### Alternative without redirect to current year
|
||||
|
||||
One possible modification to this setup would be if you are progressively releasing content to your current students (e.g., `2025`) but you wanted visitors to `my_organization.github.io/my_book/` to see a complete version of your book. Assuming that the ideal version for such visitors is the completed book from the previous year (`2024`), you could do this:
|
||||
- Set `PRIMARY_BRANCH` to `2024`
|
||||
- Set `BEHAVIOR_PRIMARY` to `copy`
|
||||
|
||||
As your current students may then accidentally go to the older version of the book, we recommend you use a banner to indicate to readers that there is a (partial) new version available, and advise them where to find it. You can add a banner using this workflow (`BRANCHES_ARCHIVED`) or the [standard Jupyter Book banner feature](https://jupyterbook.org/en/stable/web/announcements.html).
|
||||
|
||||
### Books with active editors working in parallel
|
||||
|
||||
Consider a case where several authors are working on material for a book and you would like to be able to see the work of any author at any time. You also have a branch that is used to share finalized material with your readers (we call this a "release" branch) and a branch that is used to collect and review the work of all authors before releasing it (we call this a "draft" branch).
|
||||
|
||||
Assume for this example that we are working in the "my_organization" GitHub Organization in repository "my_book." The released book is on branch `release` the draft book is on branch `draft`; author branches are `author_1`, `author_2`, etc. The desired URL structure is thus:
|
||||
- official (released) version of the book is at `my_organization.github.io/my_book/`
|
||||
- draft version of the book is at `my_organization.github.io/my_book/draft/`
|
||||
- the work of each author can be found at `my_organization.github.io/my_book/author_1/`, etc.
|
||||
|
||||
To create this behavior, do the following:
|
||||
|
||||
- Create a branch for each author as well as `release` and `draft` branches
|
||||
- Set `draft` to the default branch
|
||||
- Set `PRIMARY_BRANCH` to `release`
|
||||
- Set `BEHAVIOR_PRIMARY` to `copy`
|
||||
|
||||
Note that in this situation we strongly recommend using the Draft-Release workflow that is incorporated in the TeachBooks Python package, which allows you to restrict specific content from appearing in the `release` book that is already incorporated in the `draft` book. [Find out more here](./draft-release.md). This is useful, for example, if you would like to review many chapters, but release only one at a time, or use a banner in the draft book (e.g., via `_config.yml`) but not the released book.
|
||||
|
||||
#### Why make the draft branch default?
|
||||
|
||||
What if you want to make sure the source code for the released book is visible in the repository, rather than the draft version (e.g., you want to make sure external visitors see this version of the material)? You can do this by making `release` your default branch instead of `draft`. However, this also means that Pull Requests will be default be made into the `release` branch instead of `draft`, which may alter the working method of your team in an undesirable way (e.g., not being able to use a `draft` branch, accidentally releasing material before checking on `draft`, or having to manually adjust every PR that is created by GitHub to merge into `draft` instead of `release`).
|
||||
|
||||
(private_submodules)=
|
||||
## Private submodules
|
||||
In case your book includes private submodules, you'll need to create a Personal Access Token (classic) with at least the scope `repo` as described in the [github documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), and add this token with the name `GH_PAT` as a `Repository secret` or `Organization secret` (<svg aria-label="Edit repository metadata" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-gear float-right"> <path d="M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z"></path> </svg>`Settings` > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-key-asterisk"> <path d="M0 2.75A2.75 2.75 0 0 1 2.75 0h10.5A2.75 2.75 0 0 1 16 2.75v10.5A2.75 2.75 0 0 1 13.25 16H2.75A2.75 2.75 0 0 1 0 13.25ZM2.75 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25V2.75c0-.69-.56-1.25-1.25-1.25Z"></path><path d="M8 4a.75.75 0 0 1 .75.75V6.7l1.69-.975a.75.75 0 0 1 .75 1.3L9.5 8l1.69.976a.75.75 0 0 1-.75 1.298L8.75 9.3v1.951a.75.75 0 0 1-1.5 0V9.299l-1.69.976a.75.75 0 0 1-.75-1.3L6.5 8l-1.69-.975a.75.75 0 0 1 .75-1.3l1.69.976V4.75A.75.75 0 0 1 8 4Z"></path></svg>`Secrets and variables` > `Actions` > `Repository secrets` or `Organization secrets`.) Furthermore, manually copy the workflow (.github/workflows/deploy-book.yml) in your own repository as the authorization doesn't work with the called workflow.
|
||||
|
||||
(gh-workflow-summary)=
|
||||
## View the workflow progress and summary
|
||||
|
||||
Whenever the workflow is triggered, its progress and a summary can be seen under the <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions`- `All workflows` - `call-deploy-book` in GitHub! It shows you a descriptive summary:
|
||||
- Ill-defined repository configuration variables (in `Annotations`)
|
||||
- Which branches are released and where (`https://<username/organization_name>.github.io/<repository_name>` (case sensitive)) including which branch is released on the website root and the applied alias
|
||||
- Errors in the build process
|
||||
- How the repository variables are defined during the build.
|
||||
|
||||
Here's an example for a summary for the template book:
|
||||
|
||||
> ### Branches deployed
|
||||
> | Branch 🎋 | Link 🔗 | Build status ☑️ |
|
||||
> | :--- | :--- | :--- |
|
||||
> | main | [https://teachbooks.github.io/template/main](https://teachbooks.github.io/template/main) | ✅ `Released` |
|
||||
> | version2 | [https://teachbooks.github.io/template/version2](https://teachbooks.github.io/template/version2) | 🔴 `Build failed [1]` |
|
||||
> | version3 | [https://teachbooks.github.io/template/version3](https://teachbooks.github.io/template/version3) | ⭕ `Build failed [2]` |
|
||||
>
|
||||
> #### Legend for build status
|
||||
> ✅ `Released` - build success, new version released.
|
||||
>
|
||||
> 🔴 `Build failed [1]` - build failure, previous version of the book reused.
|
||||
>
|
||||
> ⭕ `Build failed [2]` - build failure, no previous version reused.
|
||||
>
|
||||
> #### Primary book at root
|
||||
> The book at the website root <https://teachbooks.github.io/template/> redirects to the primary branch `main` (status: ✅ `Released`).
|
||||
>
|
||||
> ### Aliases
|
||||
> | Alias ➡️ | Target 🎯 | Link 🔗 | Build status ☑️ |
|
||||
> | :--- | :--- | :--- | :---- |
|
||||
> | draft | main | [https://teachbooks.github.io/template/draft](https://teachbooks.github.io/template/draft) | ✅ `Released` |
|
||||
>
|
||||
> ### Preview of build errors & warnings
|
||||
> For more details please see the corresponding `build-books` jobs in the left pane.
|
||||
>
|
||||
> On branch `version2`:
|
||||
> ```
|
||||
> <20>[91m/home/runner/work/template/template/book/some_content/overview.md:5: WARNING: Non-consecutive header level increase; H1 to H3 [myst.header]<5D>[39;49;00m
|
||||
> ```
|
||||
>
|
||||
> On branch `version3`:
|
||||
> ```
|
||||
> /home/runner/work/_temp/ff8c8325-8d8b-4c0b-a2b2-32d2169c55bc.sh: line 8: teachbooks: command not found
|
||||
> ```
|
||||
>
|
||||
> ### Repository configuration variables
|
||||
> Variables can be set at <https://github.com/TeachBooks/template/settings/variables/actions>
|
||||
>
|
||||
> ```
|
||||
> PRIMARY_BRANCH=main (default value used)
|
||||
> BRANCH_ALIASES=draft:main
|
||||
> BRANCHES_TO_DEPLOY=* (default value used)
|
||||
> BRANCHES_TO_PREPROCESS=main
|
||||
> BEHAVIOR_PRIMARY=redirect (default value used)
|
||||
> BRANCHES_ARCHIVED= (default value used)
|
||||
> ```
|
||||
|
||||
(gh-caching)=
|
||||
## Caching
|
||||
|
||||
The GitHub Action [Cache](https://github.com/actions/cache) is used in the Deploy Book Workflow (DBW) to save time when building the book. This is accompliched by caching two sets of files for each branch: 1) the Python virtual environment, and 2) the build artifact (the HTML files forming each book website).
|
||||
|
||||
The reason for doing this stems from the primary purpose of the Deploy Book Workflow, which builds many versions of a book based on each branch, as well as creating a Python virtual environment from the `requirements.txt` file in the repository. A unique environment for each branch is necessary to test changes to book dependencies and configuration in an isolated way, but can dramatically increase the time required to build all versions of the book when the DBW runs. In addition, it also takes time to build the book itself. For this reason, both of these sets of files are cached (although at the moment, most of the time savings is primarily caching the build artifact).
|
||||
|
||||
This works by hashing a specific set of files and including that in the filename of the cache. Every time the workflow is triggered, a new hashed filename is created and compared to the list of existing caches to see if one with the same name exists; if so, the cache is reused. If not, a new environment and/or build artifact is constructed and a new cache is made.
|
||||
|
||||
Cached files can be found in GitHub under the Actions tab, then looking for the "Caches" section under the "Management" pane on the left hand side of the screen. For example, this link shows the [caches for this TeachBooks Manual](https://github.com/TeachBooks/manual/actions/caches). If needed, caches can be deleted manually from this page. A cache will expire if unused for longer than 1 week or if the maximum allowed disk space for all cached files is exceeded (both are GitHub policies).
|
||||
|
||||
Files created during a GitHub Action are called [artifacts](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow). Although this is _not_ the same thing as a cache, the files in a specific cache or artifact are identical. Artifacts have their own expiration period, which is possible to [customize in the repository settings](https://docs.github.com/en/organizations/managing-organization-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization) (default is 90 days). Unexpired artifacts can be viewed at the bottom of any workflow run summary that is available on the Actions tab of a GitHub repository.
|
||||
|
||||
To add even more confusion to the situation, if an artifact built during an Action is a set of HTML files (a website) that are used to create a GitHub Pages website, the files served when visiting the URL for that are stored on a webserver; they are _not_ the artifact files, but are identical. Fortunately webserver files are preserved indefinitely (or until GitHub changes this policy), meaning that even though your cache or artifact may be deleted, the website will still remain active.
|
||||
|
||||
The cache is a key component of the DBW and leads to several considerations for the building and maintenance of a book, which are explained below, after the criteria for each cache type are described.
|
||||
|
||||
### Cached Environment
|
||||
|
||||
The DBW uses [Python virtual environments](https://docs.python.org/3/library/venv.html) (`python -m venv .venv`) and `python -m pip install -r requirements.txt` to install packages and create the book building environment. The entire `.venv` directory is preserved in the cache with a file name beginning with `venv-...`. The week number is also included in the file hash, which ensures that a new hash is created at least once per week.
|
||||
|
||||
Once created during a successful build action, an existing cached environment will be found and reused unless two specific criteria are met: 1) a book build is required (replacing the cached build artifact), _and_ 2) the `requirements.txt` file is changed. Requirements for a "book build" are described in the next section.
|
||||
|
||||
Note that any change to the `requirements.txt` file will trigger creation of a new environment, not necessarily one that specifies the version number of a package.
|
||||
|
||||
Note that Specifying package version numbers explicitly and updating them via [Dependabot](./update_env.md) is an excellent way to ensure that environments in the DBW are always up to date and this issue is avoided.
|
||||
|
||||
If you are _not_ using Dependabot and are not able to get your packages updated when the DBW is running, delete the cache manually and rerun your GitHub Actions job (go to Actions tab, then looking for the "Caches" section under the "Management" pane on the left hand side of the screen).
|
||||
|
||||
### Cached Build Artifacts
|
||||
|
||||
Build artifacts are the HTML files that define the website (i.e., the book) and are typically located in the subdirectory `book/_build/html` of a repository once the book is built. Note that these files are typically only visible if you are building the book locally, as they are not committed to the repository by default (i.e., `.gitignore`). For users only using the DBW and the GitHub browswer editor, downloading the build cache is the easiest way to view these files, which have filenames beginnig with `html-build-<branch-name>-...`.
|
||||
|
||||
Once created during a successful build action, an existing cached build artifact will be found and reused unless _any_ of three specific criteria are met: 1) a change is made to a file in `book/`, 2) the `requirements.txt` file is changed, or 3) the status of a branch as archive or preprocess has changed (`BRANCHES_TO_PREPROCESS` of `BRANCHES_ARCHIVED`).
|
||||
|
||||
Immediately after a successful build action, the book website files exist in three places: cache, artifact and on a GitHub webserver. However, as described at the beginning of this section, the cache will be automatically deleted after 1 week, if unused, and the artifact will be deleted based on the setting in your repository (90 days by default).
|
||||
|
||||
### Effect of Caching on Book Workflow
|
||||
|
||||
Implementation of the DBW has several characteristics that should be noted which could help understand certain behaviors of the book build and website deployment process. These points may be useful to consider if you are experiencing undesired behavior in your Actions builds and/or your actual book websites.
|
||||
|
||||
- Remember that the DBW action will only run if a commit is made that changes `requirements.txt` or contents of `book/`
|
||||
- When first creating a repository, the action may not run, or may run and fail; occasionally it is needed to make a new commit to get the workflow to run for the first time (remember to modify something in `book/`) or you may try to re-run the job from the Actions tab
|
||||
- when using multiple branches, only the branch that is edited will be updated
|
||||
- the website for each branch may be built with a different Python environments (different package versions)
|
||||
|
||||
Unlike the virtual environments (next subsection), caches of the book build do not influence subsequent builds of the book, as this artifact is replaced whenever a commit to a specific branch triggers a new build process. As described above, old cached build artifacts are used if the build process from a new commit fails, ensuring that the URL of a website does not return a 404 page.
|
||||
|
||||
### Effect of Caching on Virtual Environment
|
||||
|
||||
In particular, note that older branches may have been built with cached environments that are different than those in a newer branch, leading to (undesired) differences in book appearance or functionality---often without the author being aware! This occurs if a package in `requirements.txt` is updated in the time between the creation of environments on different branches, as `pip` will use the newest version when downloading a package (the first time a venv cache is created in the DBW), but it will not always automatically update a package if `pip install -r requirements.txt` is used on an existing environment (this happens every time an existing cache is used!). This means that, when compared to the venv on a newer branch, a frequently used branch (where the cache has not expired) may retain old and out of date packages long after an updated version is available; however, since the week number is included in the venv file hash, this will last for a maximum of 1 week. A best practice to avoid this situation is to pin version numbers explicitly (e.g., `teachbooks==0.2.0`) if you want book builds to remain consistent. In addition, a feature like dependabot can be used to automatically notify you when an update is made; this is [here](./update_env.md).
|
||||
80
book/features/sphinx-proof.md
Normal file
80
book/features/sphinx-proof.md
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
````{margin}
|
||||
```{attributiongrey} Attribution
|
||||
:class: attribution
|
||||
This page reuses MIT licensed content from {cite:t}`sphinx-proof`. {fa}`quote-left`{ref}`Find out more here.<external_resources>`
|
||||
```
|
||||
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 3-5.
|
||||
```
|
||||
+++
|
||||
{bdg-primary}`Sphinx Extension`
|
||||
{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`
|
||||
{bdg-link-primary-line}`Included in TeachBooks Favourites <./favourites.html>`
|
||||
````
|
||||
|
||||
# Sphinx proof
|
||||
|
||||
This extensions provides an easy way to add proofs, theorem, axioms and much more to your book. It is created by the Executable Books team and is [documented here](https://sphinx-proof.readthedocs.io/en/latest/).
|
||||
|
||||
TeachBooks has made some small modifications to the original extension, such that it works well with translated books; this modified version is located in the repository [github.com/TeachBooks/sphinx-proof](https://github.com/TeachBooks/sphinx-proof).
|
||||
|
||||
## What does it do?
|
||||
|
||||
This extension defines proofs, theorems, axioms and other similar concepts as new admonition types:
|
||||
|
||||
````{prf:example}
|
||||
:label: my-example
|
||||
|
||||
Next, we shut down randomness in demand and assume that the demand shock
|
||||
$\nu_t$ follows a deterministic path:
|
||||
|
||||
|
||||
```{math}
|
||||
\nu_t = \alpha + \rho \nu_{t-1}
|
||||
```
|
||||
|
||||
Again, we’ll compute and display outcomes in some figures
|
||||
|
||||
```python
|
||||
ex2 = SmoothingExample(C2=[[0], [0]])
|
||||
|
||||
x0 = [0, 1, 0]
|
||||
ex2.simulate(x0)
|
||||
```
|
||||
````
|
||||
|
||||
More information can be found in the [official documentation](https://sphinx-proof.readthedocs.io/en/latest/index.html). It can be [configured in combination the TeachBooks extension to include examples with executable code and visuals](../_git/github.com_TeachBooks_sphinx-code-examples/main/MANUAL.ipynb).
|
||||
|
||||
## Installation
|
||||
To use this extenstion, follow these steps:
|
||||
|
||||
**Step 1: Install the Package**
|
||||
|
||||
Install the TeachBooks' version of `sphinx-exercise` package using `pip`:
|
||||
```
|
||||
pip install sphinx-proof @ git+https://github.com/TeachBooks/sphinx-proof.git
|
||||
```
|
||||
|
||||
**Step 2: Add to `requirements.txt`**
|
||||
|
||||
Make sure that the package is included in your project's `requirements.txt` to track the dependency:
|
||||
```
|
||||
sphinx-proof @ git+https://github.com/TeachBooks/sphinx-proof.git
|
||||
```
|
||||
|
||||
**Step 3: Enable in `_config.yml`**
|
||||
|
||||
In your `_config.yml` file, add the extension to the list of Sphinx extra extensions (**important**: underscore, not dash this time):
|
||||
```
|
||||
sphinx:
|
||||
extra_extensions:
|
||||
.
|
||||
.
|
||||
.
|
||||
- sphinx_proof
|
||||
.
|
||||
.
|
||||
.
|
||||
```
|
||||
36
book/features/teachbooks_intro.md
Normal file
36
book/features/teachbooks_intro.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
````{margin}
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 4-5.
|
||||
|
||||
{bdg-link-secondary}`Python Package: TeachBooks`
|
||||
{bdg-link-light}`Included in TeachBooks Template <../external/template/README.html>`
|
||||
|
||||
```
|
||||
````
|
||||
|
||||
(teachbooks_package)=
|
||||
# TeachBooks Python Package
|
||||
|
||||
The TeachBooks Python package is a collection of tools that are used to enhance the Jupyter Book software package by adding features and making customization easier. In general, it is only of interest to user types 4 and 5 when building a book locally. However, it may be important for other users to know what the package does, as it is incorporated in the [Deploy Book Workflow](../external/deploy-book-workflow/README.md) and, therefore, any book created from the [TeachBooks Template](../external/template/README.md). This raises two important points:
|
||||
|
||||
1. If you are a book user using the [TeachBooks Template](../external/template/README.md) and/or the [Deploy Book Workflow](../external/deploy-book-workflow/README.md), your book is by default built with the `teachbooks` package, and the way your book is built and features that are included in the book may change automatically when it is updated (these will be non-breaking changes; if not, we will notify our mailing list).
|
||||
2. If you are using the `jupyter-book` package to build your book, some of the features described in this Manual may not be available to you (i.e., those listed on this page). This will be the case if you are using a [setup described in the Jupyter Book Manual](https://jupyterbook.org/en/stable/publish/web.html), for example, [this GitHub workflow](https://jupyterbook.org/en/stable/publish/gh-pages.html).
|
||||
|
||||
For those who wish to use the package, it is available on [PyPI](https://pypi.org/project/teachbooks/) and can be installed using `pip install teachbooks`. As `teachbooks` is a wrapper, the package is meant to replace the usage of `jupyter-book` commands (although it does indeed add a few new commands to the CLI, e.g., `serve`). It is conventionally used in an identical way, as follows:
|
||||
|
||||
```
|
||||
teachbooks build book
|
||||
```
|
||||
|
||||
This Manual describes the main features and usage of the package. For those who wish to understand more of hte technical details, note that the implementation the API is is documented at [teachbooks.readthedocs.io/](https://teachbooks.readthedocs.io/).
|
||||
|
||||
## List of Features
|
||||
|
||||
Items in the list here are currently implemented in the TeachBooks package and described on other pages of this manual:
|
||||
- [Draft-Release Workflow](./draft-release.md)
|
||||
- [External Contents](./external_toc.md)
|
||||
- [Local Server](./local_server.md)
|
||||
|
||||
The package is also set up to handle [APA references](./apa) when using the Draft-Release Workflow (the `_ext` subdirectory and its contents are manually copied during the pre-build phase). This will not be necessary once the APA Reference feature is turned into a proper Sphinx extension or Pybtext plugin.
|
||||
62
book/features/write_online.md
Normal file
62
book/features/write_online.md
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
````{margin}
|
||||
```{admonition} User types
|
||||
:class: tip
|
||||
This section is useful for user type 3-5.
|
||||
```
|
||||
|
||||
{bdg-link-light}`Uses Deploy Book workflow <../external/deploy-book-workflow/README.html>`
|
||||
{bdg-link-light}`Uses TeachBooks Template <../external/template/README.html>`
|
||||
|
||||
|
||||
````
|
||||
|
||||
# Write book fully in GitHub interface
|
||||
|
||||
Using the GitHub tooling in combination with TeachBook's software, users are able to write their book fully online, without the need to install any software locally. This is especially useful for users that are not familiar with Git and GitHub, or do not have the rights to install software on their computer. To make this possible, users can start with the [TeachBooks Template](../external/template/README.md) after which they make use of the [Deploy Book Workflow](../external/deploy-book-workflow/README.md) to automatically build and release their book online.
|
||||
|
||||
## How to do this
|
||||
|
||||
New users can start writing their book by following the steps shown in the [TeachBooks Template repository](https://github.com/TeachBooks/template).
|
||||
|
||||
Users who already have a TeachBook repository can add the Deploy Book Workflow as explained [here](./release_book_online.md).
|
||||
|
||||
After that, users can start writing and editing their book fully online in the GitHub interface. This is supported with:
|
||||
- Automatic book builds for all version. See [](./release_book_online.md) for more information
|
||||
- A summary describing where the TeachBook is released, errors in the build process per branch and how the release step is configured
|
||||
|
||||
## Example of summary
|
||||
|
||||
Whenever the workflow is triggered, its progress and a summary can be seen under the <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions`- `All workflows` - `call-deploy-book` in GitHub! It shows you a descriptive summary. This summary includes, among others, the errors in the build process per branch and where the book is released online.
|
||||
|
||||
Here's an example for a summary for the template book:
|
||||
|
||||
> ### Branches deployed
|
||||
> | Branch 🎋 | Link 🔗 | Build status ☑️ |
|
||||
> | :--- | :--- | :--- |
|
||||
> | main | [https://teachbooks.github.io/template/main](https://teachbooks.github.io/template/main) | ✅ `Released` |
|
||||
> | version2 | [https://teachbooks.github.io/template/version2](https://teachbooks.github.io/template/version2) | 🔴 `Build failed [1]` |
|
||||
> | version3 | [https://teachbooks.github.io/template/version3](https://teachbooks.github.io/template/version3) | ⭕ `Build failed [2]` |
|
||||
>
|
||||
> #### Legend for build status
|
||||
> ✅ `Released` - build success, new version released.
|
||||
>
|
||||
> 🔴 `Build failed [1]` - build failure, previous version of the book reused.
|
||||
>
|
||||
> ⭕ `Build failed [2]` - build failure, no previous version reused.
|
||||
>
|
||||
> ### Preview of build errors & warnings
|
||||
> For more details please see the corresponding `build-books` jobs in the left pane.
|
||||
>
|
||||
> On branch `version2`:
|
||||
> ```
|
||||
> <20>[91m/home/runner/work/template/template/book/some_content/overview.md:5: WARNING: Non-consecutive header level increase; H1 to H3 [myst.header]<5D>[39;49;00m
|
||||
> ```
|
||||
>
|
||||
> On branch `version3`:
|
||||
> ```
|
||||
> /home/runner/work/_temp/ff8c8325-8d8b-4c0b-a2b2-32d2169c55bc.sh: line 8: teachbooks: command not found
|
||||
> ```
|
||||
>
|
||||
|
||||
## Exercise
|
||||
Check out [the exercises](https://teachbooks.io/template/exercises.html) in the TeachBooks template to see for yourself how you can write and edit your book fully online in GitHub!
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
# Scripts for automating workflow
|
||||
|
||||
This chapter contains a few scripts which can be useful in the book-editing process:
|
||||
This chapter contains a few scripts which can be useful in the book-editing process, all of which are scripts and/or files stored in other repositories (they are _not_ Sphinx extensions).
|
||||
|
||||
- [LaTeX to markdown conversion](tex_md_converter) to convert a LaTeX file into jupyter-book compatible markdown.
|
||||
- [Snippitall](Snippitall) to insert the same code snippet at a certain point in each md file in a specific folder and all subfolder.
|
||||
- [Snippitonce](Snippitonce) to insert the same code snippet at a certain point in each md file only in a specific folder.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Here's a table summarizing the information:
|
|||
|--|----------|-------------|
|
||||
| Account | Free GitHub account (owned by Microsoft) 🤝 | Closed, TU Delft account 🔒 |
|
||||
| Book url | GitHub pages (`<organization/username>.github.io/<book>`), for TU Delft books a custom URL (`oit.tudelft.nl/<book>`), for private books on TU Delft GitHub Enterprise with SSO a random URL (`<random>.github.io/<book>`), or custom url `<anything>.<anything>/<book>`> 🌐 | TU Delft OIT (`interactivetextbooks.tudelft.nl/<book>`) 🎓 |
|
||||
| Real-time book editing | Automated and flexible (multiple version of the book, building error insights, fast, custom urls) with [DBW](deploy-book-workflow-intro) 🚀 | Some automated scripts exist, but simplistic (not easily adaptable, no caching environments, no visual summaries, no parallel processes) 🛵 For TU Delft OIT: restricted adaptations because of copyright checks 🚫 |
|
||||
| Real-time book editing | Automated and flexible (multiple version of the book, building error insights, fast, custom urls) with [DBW](../external/deploy-book-workflow/README.md) 🚀 | Some automated scripts exist, but simplistic (not easily adaptable, no caching environments, no visual summaries, no parallel processes) 🛵 For TU Delft OIT: restricted adaptations because of copyright checks 🚫 |
|
||||
| Setting up book website | Immediate and automated with [template](../external/template/README.md) ⚡️ | Manual setup on personal webserver, or access required by TeachBooks or TU Delft OIT 🚧 |
|
||||
| Book access with SSO | Only available for GitHub pages on GitHub Enterprise of TU Delft 🎓, optional with custom URL ✅ | Optional ✅ |
|
||||
| Access to source code | Private (if part of organization linked to educational account) /public / internally TU Delft (on GitHub Enterprise of TU Delft) 👥 | Private / public (read-only) / internally TU Delft, editing requires requires SSO login 👥 👀 |
|
||||
|
|
|
|||
|
|
@ -183,3 +183,18 @@
|
|||
note = {Retrieved April, 2025. MIT License.},
|
||||
}
|
||||
|
||||
@misc{sphinx-proof,
|
||||
author = {{executablebooks}},
|
||||
title = {Sphinx Proof},
|
||||
url = {https://github.com/executablebooks/sphinx-exercise},
|
||||
year = {2024},
|
||||
note = {Retrieved September, 2025. MIT License.},
|
||||
}
|
||||
|
||||
@misc{sphinx-exercise,
|
||||
author = {{executablebooks}},
|
||||
title = {Sphinx Exercise},
|
||||
url = {https://github.com/executablebooks/sphinx-exercise},
|
||||
year = {2024},
|
||||
note = {Retrieved September, 2025. MIT License.},
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ This section is useful for user type 3-5.
|
|||
|
||||
# Figure syntax maker
|
||||
|
||||
One might quickely forget the code for making figures, here is a useful tool to make your figures, just specify all information and the code is produced for you:
|
||||
One might quickly forget the code for making figures, so here we provide a useful tool to make the source code for figures. Simply specify the information in the empty fields below and the code is produced for you automatically:
|
||||
|
||||
<div id="figuur_formulier">
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue