You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,4 @@ The released book can be found on on https://teachbooks.io/manual. This page sho
20
20
Some parts of this book are taken from other sources in the form of submodules (linked in the folder [book/external](book/external)). To contribute to those pages, contribute to the source repository directly with a fork and merge/pull request. If you intent to clone this book including its submodules, clone using: `git clone --recurse-submodules git@github.com:TeachBooks/manual.git`
@@ -74,4 +76,4 @@ We recommend you install this in an environment that is specifically dedicated f
74
76
75
77
The package is a CLI tool that primarily provides a wrapper around the Jupyter Book package which is used for pre- and postprocessing. In this case "wrapper" refers to the CLI usage: CLI commands generally invoke `jupyter-book` commands internally; the `jupyter-book` package is _not_ distributed within the `teachbooks` package.
76
78
77
-
The source code and function of the package will eventually be documented on a Sphinx-built website ([teachbooks.io/TeachBooks/](https://teachbooks.io/TeachBooks/)), however, this is currently still under construction.
79
+
The source code and function of the package will eventually be documented on a Sphinx-built website ([teachbooks.io/TeachBooks/](https://teachbooks.io/TeachBooks/)), however, this is currently still under construction.
@@ -16,9 +16,7 @@ When creating books, you might want to reuse material from other people or from
16
16
17
17
Previously, this book feature was implemented using [submodules](../external/Nested-Books/README.md), but the implementation was more difficult to use. Despite this, submodules are still a widely used Git feature that can be very useful for book authors, so check out the [submodules page](../external/Nested-Books/README.md) to learn more, especially if the External TOC tool does not satisfy your needs. Submodules have a few additional features not (yet) implemented using the External TOC.
18
18
19
-
```{warning}
20
-
The External TOC features are not incorporated in the new deploy book workflow yet (this will happen once the workflow specifies `teachbooks>=0.2.0`).
21
-
```
19
+
The External TOC features are incorporated in the teachbooks package starting with version `0.2.0`.
@@ -23,4 +23,76 @@ Additionally, not all features are built and shared in the same way. We do our b
23
23
24
24
Finally, the purpose, installation process and usage of each features is elaborated on in the respective sub-sections.
25
25
26
-
To see examples for these features, go to the [Examples chapter](../examples/overview.md).
26
+
To see examples for these features, go to the [Examples chapter](../examples/overview.md).
27
+
28
+
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.
29
+
30
+
(teachbooks_package)=
31
+
## TeachBooks Python Package
32
+
33
+
````{margin}
34
+
```{admonition} User types
35
+
:class: tip
36
+
This section is useful for user type 4-5.
37
+
```
38
+
````
39
+
40
+
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:
41
+
42
+
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).
43
+
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).
44
+
45
+
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:
46
+
47
+
```
48
+
teachbooks build book
49
+
```
50
+
51
+
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/).
52
+
53
+
### List of Features
54
+
55
+
Items in the list here are currently implemented in the TeachBooks package and described on other pages of this manual:
56
+
-[Draft-Release Workflow](./draft-release.md)
57
+
-[External Contents](./external_toc.md)
58
+
-[Local Server](./local_server.md)
59
+
60
+
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.
61
+
62
+
(deploy-book-workflow-intro)=
63
+
## Deploy Book Workflow
64
+
65
+
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.
66
+
67
+
### Related Features
68
+
69
+
A list of tools and features that are dependent on, or related to, the Deploy Book Workflow (DBW) is provided here:
70
+
71
+
Important for these features:
72
+
-[](../external/deploy-book-workflow/README.md): the main DBW page
73
+
-[](../external/template/README.md): books created from the Template include DBW by default
74
+
-[](./draft-release.md): can be configured directly using the DBW
75
+
-[](./update_env.md): behaviors of this tool may influence the DBW
76
+
- {ref}`TeachBooks Python Package <teachbooks_package>`: included by default in the DBW
77
+
-[](./pull_request_build.md): created to provide DBW-like behavior for PR's from forked repositories
78
+
-[](./apa.md): a temporary fix is included in `teachbooks` to enable use in the DBW
79
+
80
+
### Book Build Commands
81
+
82
+
By default the DBW builds books using the following command:
83
+
```
84
+
teachbooks build book/
85
+
```
86
+
87
+
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:
88
+
```
89
+
teachbooks build --release book/
90
+
```
91
+
92
+
### Environmnets and Caching
93
+
94
+
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.
95
+
96
+
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.
97
+
98
+
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).
Copy file name to clipboardExpand all lines: book/features/sphinx_extensions.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,4 +7,4 @@ This section is useful for user type 4-5.
7
7
8
8
# Additional functionality
9
9
10
-
This sections includes the features developed by TeachBooks which add functionality to the book. Most of them are implemented as sphinx extensions, which are plugins developed for the Sphinx documentation ecosystem (which Jupyter Book is built upon). They extend or modify Sphinx’s capabilities. Since Sphinx extensions are not an integral part of jupyter-book, as opposed to original jupyter-book features, they must be installed and configured explicitly, for example in the `_config.yml`file.
10
+
This sections includes the features developed by TeachBooks which add functionality to the book. Most of them are implemented as sphinx extensions {bdg-primary}`Sphinx Extension`, which are plugins developed for the Sphinx documentation ecosystem (which Jupyter Book is built upon). They extend or modify Sphinx’s capabilities. Since Sphinx extensions are not an integral part of jupyter-book, as opposed to original jupyter-book features, they must be installed and configured explicitly, for example in the `_config.yml`and `requirements.txt` files.
Copy file name to clipboardExpand all lines: book/features/update_env.md
+12-8Lines changed: 12 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,21 @@ This page is useful for user type 4-5.
9
9
10
10
# Auto-updating packages
11
11
12
-
When building your book, your making use of packages: the teachbooks and jupyterbook packages themselves, but also packages for extensions. These are regularly updated, while those updates are not necessarily taken into your book. This is all defined in the `requirements.txt` file, which is provided as part of the [template](../external/template/README.md). There are three options:
13
-
1.`requirements.txt` only contains names of packages like: `download_link_replacer`. In that case, your [deploy-book-workflow](../external/deploy-book-workflow/README.md) will take the most up-to-date version when making your book website once a week (as the chache will be cleared once a week). This might lead to unexpected changes when new version come out, although new version are in general backwards compatible.
12
+
When building your book, you are making use of various Python packages: the `teachbooks` and `jupyter-book` packages themselves, but also packages for extensions. These are regularly updated, however, those updates are not necessarily incorporated into your book automatically. The list of packages and their versions are defined in the `requirements.txt` file, which is provided as part of the [template](../external/template/README.md). Consider the following three options for how packages can be specified:
13
+
1.`requirements.txt` only contains names of packages like: `download_link_replacer`. In that case, your [deploy-book-workflow](../external/deploy-book-workflow/README.md) will take the most up-to-date version when making your book website once a week (as the chache will be cleared once a week). This might lead to unexpected changes when a new version has been released (although new versions will generally be backwards compatible).
14
14
1.`requirements.txt` contains names of packages with a specified version like: `download_link_replacer==1.0.4`. In that case, your [deploy-book-workflow](../external/deploy-book-workflow/README.md) always uses that specific version. In doing so, you'll never get a new update unless you explicitly adapt the version in `requirements.txt`. If you'd like to get notified for updates, you might consider using GitHub's Dependabot.
15
-
1. A combination of 1. and 2.: In that case (once a week at most) you will receive new versions for only the unfixed packages, no updates for the fixed versions. In this case you can also use GitHub's Dependabot.
15
+
1. A combination of 1. and 2.: In that case (once a week at most) you will receive new versions for only the unfixed packages, no updates for the fixed versions.
16
+
17
+
For the case of specified versions, you can use GitHub's Dependabot to notify you that a new version is available _and_ to automatically set up a Pull Request to update your book with the new version.
16
18
17
19
## Notifications updated packages with Dependabot
18
20
19
-
Dependabot checks the specified version of packages in your `requirements.txt` file and opens a branchand pull requests whenever there's an update available for that package. Note that package without a fixed version are ignored by Dependabot.
21
+
Dependabot checks the specified version of packages in your `requirements.txt` file and, if a new version is found, will create a new branch, update the `requirements.txt` file and open a Pull Request whenever there's an update available for that package. Note that packages without a fixed version are ignored by Dependabot.
20
22
21
23
To activate this feature:
22
24
1. Specify version for all packages you want to be notified on in your `requirements.txt` file. See [`requirements.txt`](https://github.com/TeachBooks/manual/blob/release/requirements.txt) of this manual as an example
23
25
1. In the `.github/` directory, add a file named `dependabot.yml` with the following content (note that sphinx-thebe (used in [python live coding](./live_code.ipynb)) and docutils (using in [APA referencing](./apa.md)) are ignored because these require a very specific version to work):
26
+
24
27
```yaml
25
28
version: 2
26
29
updates:
@@ -35,11 +38,12 @@ updates:
35
38
- dependency-name: "docutils"
36
39
```
37
40
38
-
This will check every sunday around midnight (UTC) whether any of the fixed-version packages are updated. If so, several things will happen:
39
-
1. A new branch starting with _dependabot_ will be created in the repository and any relevant workflows will be triggered.
40
-
1. A _pull request_ will be created to pull the new branch into the _default_ branch. This pull request must be manually reviewed and merged. Afterwards the _dependabot_ branch can be deleted (automatically).
41
+
This check will run every Sunday around midnight (UTC) whether any of the fixed-version packages are updated. If so, several things will happen:
42
+
1. A new branch is created with a name that begins with `dependabot...` in the repository
43
+
1. A commit is made updating `requirements.txt` (e.g., `jupyterbook_patches==1.4.2` is changed to `jupyterbook_patches==1.4.4`)
44
+
1. A _pull request_ will be created to merge the new branch into the _default_ branch. This pull request must be manually reviewed and merged. Afterwards the _dependabot_ branch can be deleted (automatically).
41
45
42
-
If the workflow `call-deploy-book` is used, and you don't want the _dependabot_ branches to be built and deployed (and all other branches you do want), you can achieve this by adding the next to the file `call-deploy-book.yml`:
46
+
Note that these activities will occur automatically and may trigger other workflows in your repository (for example, the building of a book on another branch). If the workflow `call-deploy-book` is used, and you don't want the _dependabot_ branches to be built and deployed (and all other branches you do want), you can achieve this by adding the following text to the file `call-deploy-book.yml`:
Copy file name to clipboardExpand all lines: book/intro.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,4 +16,4 @@ There are several "parts" to the manual:
16
16
- The **Features** part describes a suite of tools that are useful for teachers, many of which are developed by TeachBooks contributors specifically for use in education. Many of these tools are illustrated in the **Examples**.
17
17
- A few special tools are included in the **Editing Tools** that are useful when writing content.
18
18
19
-
See the final chapters of this book (under **Miscellaneous**) for additional information about References, Credits, etc.
19
+
See the final chapters of this book (under **Miscellaneous**) for additional information about References, Credits, etc.
0 commit comments