Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPGRADE: myst-nb and many other dependencies #1842

Merged
merged 67 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
7a79c97
Pin myst-nb to 0.16 and fix tests
cadr Aug 30, 2022
c33eb1f
Merge branch 'master' into update-myst-nb
mmcky Sep 21, 2022
030b73e
Update sphinx-jupyterbook-latex version
mmcky Sep 21, 2022
6a3d059
Update deprication notices in docs
mmcky Sep 21, 2022
47ed1e1
Revert "Update deprication notices in docs"
mmcky Sep 21, 2022
496a9c9
adding nb_ for execution variables
AakashGfude Sep 28, 2022
146698b
mystnb config
AakashGfude Oct 2, 2022
473d246
substitutions key has myst object
AakashGfude Oct 2, 2022
e0975b4
correcting CHANGELOG
AakashGfude Oct 2, 2022
3e9bd03
glue and substitutions
AakashGfude Oct 2, 2022
b95d364
suppressing warnings of unknown mime type and domains
AakashGfude Oct 3, 2022
23d7194
mime_priority for latex
AakashGfude Oct 4, 2022
7da70f5
substitutions key in code outputs
AakashGfude Oct 5, 2022
998ae52
typo
AakashGfude Oct 9, 2022
915de95
changes in execute doc
AakashGfude Oct 9, 2022
623cab3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 9, 2022
aa4f03b
changed nb_render_priority in docs
AakashGfude Oct 10, 2022
7f5c23b
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Oct 10, 2022
313685b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 10, 2022
25dcf7e
typo
AakashGfude Oct 10, 2022
7414d0a
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Oct 10, 2022
0b61b6c
update version to 0.14
mmcky Nov 4, 2022
c89552f
migration file
AakashGfude Nov 7, 2022
78f25bf
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Nov 7, 2022
e77c4c3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2022
1e7719a
giving correct link of migration
AakashGfude Nov 7, 2022
3151b57
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Nov 7, 2022
f6a0603
update docs for migration assistance to latest jupyter-book, update t…
mmcky Nov 8, 2022
f80d19a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 8, 2022
6ff0a82
fix precommit
mmcky Nov 8, 2022
29c4baf
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
mmcky Nov 8, 2022
6ce4874
adding more migration docs
AakashGfude Nov 9, 2022
5d60bf2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2022
77f47ee
adding sphinx version 5
AakashGfude Nov 9, 2022
1af724e
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Nov 9, 2022
d72614b
sphinx-version
AakashGfude Nov 9, 2022
485eb22
sphinx version
AakashGfude Nov 9, 2022
85f133c
sphinx version
AakashGfude Nov 9, 2022
fdefe3e
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
mmcky Nov 14, 2022
aae4296
upgrade sphinx-design from 0.1 to 0.3
mmcky Nov 14, 2022
1ae8027
Merge branch 'master' into update-myst-nb
mmcky Nov 16, 2022
ba60d8a
Enable sphinx-design fontawesome for latex output
mmcky Nov 16, 2022
5d6f55e
upgrade sphinx-jupyterbook-latex==0.5.1
mmcky Nov 16, 2022
2fbfc06
update sphinx-jupyterbook-latex==0.5.2
mmcky Nov 16, 2022
9a24ce7
relax docutils to <0.19 to include 0.18.*
mmcky Nov 16, 2022
b825ac8
Upgrade sphinx-external-toc~=0.3.1
mmcky Nov 24, 2022
ae9e668
adding sbt master
AakashGfude Jan 9, 2023
a934bcb
Merge branch 'master' into update-myst-nb
AakashGfude Jan 10, 2023
1c60752
theme options
AakashGfude Jan 10, 2023
53b7f84
config test files
AakashGfude Jan 11, 2023
46a6482
removing old theme options and correcting some test files
AakashGfude Jan 11, 2023
66326db
sphinx5 test files
AakashGfude Jan 11, 2023
ae67893
toc_parts_sidebar sphinx5
AakashGfude Jan 11, 2023
379ea11
image link
AakashGfude Jan 12, 2023
9dd1a36
Merge branch 'master' into update-myst-nb
AakashGfude Jan 16, 2023
15f9268
sphinx-thebe
AakashGfude Jan 16, 2023
080aa48
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
AakashGfude Jan 16, 2023
9673e03
Merge branch 'master' into update-myst-nb
mmcky Feb 23, 2023
582a25a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2023
4fcc7f2
rework glue documentation
mmcky Feb 23, 2023
2449ff9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2023
513b485
sphinx-book-theme: revert to 0.4.0rc1 until 1.0 compat
mmcky Feb 23, 2023
0460988
Merge branch 'update-myst-nb' of https://github.com/executablebooks/j…
mmcky Feb 23, 2023
7316e32
update docs with limitations for cross-document glue
mmcky Feb 23, 2023
ba43c33
Merge branch 'master' into update-myst-nb
mmcky Feb 27, 2023
7744fde
add resolved file for merge conflict
mmcky Feb 27, 2023
8de9aea
update fixtures -- google analytics
mmcky Feb 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9"]
sphinx: [">=4,<5"]
sphinx: [">=4,<5", ">=5,<6"]

steps:
- uses: actions/checkout@v3
Expand All @@ -100,8 +100,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install wheel
pip install "sphinx${{ matrix.sphinx }}"
pip install -e .[testing]
pip install "sphinx${{ matrix.sphinx }}"

- name: Install Headless Chrome dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ This release includes a number of new features, improvements and bug fixes. Ther
* 👌 IMPROVE: Option to exclude every file not in the toc. ([docs](docs/customize/config.md), [#1123](https://github.com/executablebooks/jupyter-book/pull/1123), [@alex-treebeard](https://github.com/alex-treebeard))
* ✨ NEW: Enable the use of local Sphinx extension via _config.yml. ([docs](docs/customize/config.md), [#1102](https://github.com/executablebooks/jupyter-book/pull/1102), [@mmcky](https://github.com/mmcky))
* ✨ NEW: Enable custom builder passthrough. This is an **advanced feature**
that enables the use of additional sphinx builders via jupyter-book that may be provided by an extension. ([docs](docs/advanced/sphinx.md), [#1094]([#1094](https://github.com/executablebooks/jupyter-book/pull/1094)), [@mmcky](https://github.com/mmcky))
that enables the use of additional sphinx builders via jupyter-book that may be provided by an extension. ([docs](docs/advanced/sphinx.md), [#1094](https://github.com/executablebooks/jupyter-book/pull/1094), [@mmcky](https://github.com/mmcky))

**HTML:**

Expand Down
14 changes: 12 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ bibtex_bibfiles:

execute:
execute_notebooks: cache
stderr_output: "remove"
allow_errors: true
timeout: 120

html:
announcement: "⚠️The latest release refactored our HTML, so double-check your custom CSS rules!⚠️"
Expand All @@ -25,6 +28,8 @@ html:
use_repository_button: true
use_issues_button: true
baseurl: https://jupyterbook.org/
analytics:
google_analytics_id = ''

repository:
url: https://github.com/executablebooks/jupyter-book
Expand Down Expand Up @@ -60,9 +65,13 @@ latex:
sphinx:
config:
bibtex_reference_style: author_year # or label, super, \supercite
# unknown_mime_type - application/vnd.plotly.v1+json and application/vnd.bokehjs_load.v0+json
# domains - sphinx_proof.domain::prf needs to have `resolve_any_xref` method
# mime_priority - latex priority not set in myst_nb for text/html, application/javascript
suppress_warnings: ["mystnb.unknown_mime_type", "myst.domains", "mystnb.mime_priority"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AakashGfude are these warnings because they aren't supported mime types in the docs? This release should be able to support everything the current jupyter-book release does right?

Copy link
Contributor

@AakashGfude AakashGfude Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmcky these mime types mentioned are not specified in the default latex mime list in myst-nb : https://github.com/executablebooks/MyST-NB/blob/master/myst_nb/core/render.py#L1195. We can add them in the _config here. Or in a separate PR along with testing out the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisjsewell any suggestions with these warnings. I'm not a huge fan of suppressing families of warnings, so I wonder if we should specify the mime type order for the docs.

copybutton_prompt_text: "$"
execution_show_tb: True
execution_timeout: 120
nb_execution_show_tb: True
nb_execution_timeout: 120
html_extra_path:
- images/badge.svg
intersphinx_mapping:
Expand Down Expand Up @@ -114,6 +123,7 @@ sphinx:
content-types/jupytext.md: file-types/jupytext.Rmd
content-types/restructuredtext.md: file-types/restructuredtext.md
customize/toc.md: structure/toc.md
sd_fontawesome_latex: True


extra_extensions:
Expand Down
1 change: 1 addition & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ parts:
title: Gallery of Jupyter Books
- file: explain/components
- file: cite
- file: explain/migration
- file: reference/_changelog
title: Change log
39 changes: 26 additions & 13 deletions docs/content/code-outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ for ii in range(40):
print(f"this is output line {ii}")
```

When writing MyST markdown documents you may use `:tags: ["output_scroll"]` as an option
to the `code-cell` directive such as:

````
```{code-cell} ipython3
:tags: [output_scroll]

for ii in range(40):
print(f"this is output line {ii}")
```
````

(content:code-outputs:images)=
## Images

Expand All @@ -115,7 +127,7 @@ We can also set a caption (which is rendered as [CommonMark](https://commonmark.
````md
```{code-cell} ipython3
---
render:
mystnb:
image:
width: 200px
alt: fun-fish
Expand All @@ -134,7 +146,7 @@ produces the following code cell and figure:

```{code-cell} ipython3
---
render:
mystnb:
image:
width: 300px
alt: fun-fish
Expand Down Expand Up @@ -234,15 +246,16 @@ For example, this is the default priority list for HTML:
```yaml
sphinx:
config:
nb_render_priority:
html:
- "application/vnd.jupyter.widget-view+json"
- "application/javascript"
- "text/html"
- "image/svg+xml"
- "image/png"
- "image/jpeg"
- "text/markdown"
- "text/latex"
- "text/plain"
nb_mime_priority_overrides: [
['html', 'application/vnd.jupyter.widget-view+json', 10],
['html', 'application/javascript', 20],
['html', 'text/html', 30],
['html', 'image/svg+xml', 40],
['html', 'image/png', 50],
['html', 'image/gif', 60],
['html', 'image/jpeg', 70],
['html', 'text/markdown', 80],
['html', 'text/latex', 90],
['html', 'text/plain', 100]
]
```
61 changes: 32 additions & 29 deletions docs/content/content-blocks.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
substitutions:
key1: "I'm a **substitution**"
key2: |
```{note}
{{ key1 }}
```
fishy: |
```{image} /images/fun-fish.png
:alt: fishy
:width: 200px
```
jinja: "[Jinja templates](https://jinja.palletsprojects.com/en/2.11.x/)"
repo_name: "jupyter-book"
repo_url: "[my repo url](https://github.com/executablebooks/jupyter-book)"
myst:
substitutions:
key1: "I'm a **substitution**"
key2: |
```{note}
{{ key1 }}
```
fishy: |
```{image} /images/fun-fish.png
:alt: fishy
:width: 200px
```
jinja: "[Jinja templates](https://jinja.palletsprojects.com/en/2.11.x/)"
repo_name: "jupyter-book"
repo_url: "[my repo url](https://github.com/executablebooks/jupyter-book)"
---

# Special content blocks
Expand Down Expand Up @@ -166,7 +167,7 @@ You can use this syntax for any kind of directive, though it is generally recomm
### Insert code cell outputs into admonitions

If you'd like to insert the outputs of running code *inside* admonition
blocks, we recommend using [`glue` functionality](content:code-outputs:glue).
blocks, we recommend using [`glue` functionality](content:executable:output-insert).
For example, we'll insert one of the outputs that was glued into the book from the [code outputs page](./code-outputs.md).

For example:
Expand All @@ -176,12 +177,13 @@ For example:
```{note}
Here's my figure:

```{glue:figure} sorted_means_fig
```{glue} sorted_means_fig
:doc: executable/output-insert.md
```

````

See [](content:code-outputs:glue) for more information on how to use `glue` to insert your outputs directly into your content.
See [](content:executable:output-insert) for more information on how to use `glue` to insert your outputs directly into your content.

:::{tip}
To hide code input and output that generated the variable you are inserting, use the `remove_cell` tag.
Expand Down Expand Up @@ -470,17 +472,18 @@ To use a substitution, first add front-matter content to the top of a page like

````yaml
---
substitutions:
key1: "I'm a **substitution**"
key2: |
```{note}
{{ key1 }}
```
fishy: |
```{image} img/fun-fish.png
:alt: fishy
:width: 200px
```
myst:
substitutions:
key1: "I'm a **substitution**"
key2: |
```{note}
{{ key1 }}
```
fishy: |
```{image} img/fun-fish.png
:alt: fishy
:width: 200px
```
---
````

Expand Down Expand Up @@ -521,7 +524,7 @@ These substitutions will be available throughout your book. For example, the glo

### Formatting substitutions

MyST substitutions use {{ jinja }} in order to substite in key / values. This means that you can apply any standard Jinja formatting to your substitutions. For example, you can **replace text in your substitutions** like so:
MyST substitutions use {{ jinja }} in order to substitute in key / values. This means that you can apply any standard Jinja formatting to your substitutions. For example, you can **replace text in your substitutions** like so:

```{example}
The original key1: {{ key1 }}
Expand Down
26 changes: 16 additions & 10 deletions docs/content/executable/output-insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@ kernelspec:
name: python3
---

(content:code-outputs:glue)=
(content:executable:output-insert)=
# Store code outputs and insert into content

You often wish to run analyses in one notebook and insert them in your
documents elsewhere. For example, if you'd like to include a figure,
or if you want to cite an analysis that you have run.

```{margin}
```{warning}
Currently, `glue` only works with Python.
```

```{seealso}
There have been changes in `jupyter-book>=0.14` in the way `glue`
works. Please [see this page for more details](explain:migration).

One of the major updates is that `glue` references between documents
now require to use `:doc:`. An example is [available here](explain:migration:glue)

```

The `glue` tool from [MyST-NB](https://myst-nb.readthedocs.io/)
allows you to add a key to variables in a notebook,
then display those variables in your book by referencing the key. It
follows a two-step process:
then display those variables in your book by referencing the key.

It follows a two-step process:

* **Glue a variable to a name**. Do this by using
the `myst_nb.glue` function on a variable
Expand All @@ -39,8 +49,6 @@ We'll cover each step in more detail below.
For more information about roles, see [](../myst.md).
:::

+++

(glue/gluing)=
## Gluing variables in your notebook

Expand All @@ -61,15 +69,13 @@ You can then insert it into your text. Adding
`` {glue:}`cool_text` `` to your content results in the
following: {glue:}`cool_text`.

### Gluing numbers, plots, and tables
### Gluing numbers, plots, math, and tables

You can glue anything in your notebook and display it later with `{glue:}`. Here
You can glue anything in your notebook (or page) and display it later with `{glue:}`. Here
we'll show how to glue and paste **numbers and images**. We'll simulate some
data and run a simple bootstrap on it. We'll hide most of this process below,
to focus on the glueing part.

+++

```{code-cell} ipython3
:tags: [hide-cell]

Expand Down
24 changes: 22 additions & 2 deletions docs/content/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ execute:
execute_notebooks: auto
```

or equivalently:

```yaml
sphinx:
config:
nb_execution_mode: auto
```

Both of the above configurations are global, for per-file use `execution_mode` key.

This will only execute notebooks that are missing at least one output.
If the notebook has *all* of its outputs populated, then it will not be executed.

**To force the execution of all notebooks, regardless of their outputs**, change the
above configuration value to:

```yaml
execute_notebooks: force
execute:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AakashGfude is this configuration managed by jupyter-book or myst-nb do you know?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configurations related to executing notebooks are managed by myst-nb .

execute_notebooks: force
```

**To cache execution outputs with [jupyter-cache]**, change the above configuration
Expand All @@ -56,6 +67,15 @@ execute:

See {ref}`execute/cache` for more information.

**To execute notebooks inline during parsing**, change the above configuration value to:

```yaml
execute:
execute_notebooks: inline
```

See [Inline variable evaluation (eval)](https://myst-nb.readthedocs.io/en/latest/render/inline.html#render-eval) for more information.

**To turn off notebook execution**, change the above configuration value to:

```yaml
Expand Down Expand Up @@ -333,7 +353,7 @@ Enable activate execution tracebacks, in your `_config.yml`:
```yaml
sphinx:
config:
execution_show_tb: True
nb_execution_show_tb: True
```

See [the MyST-NB documentation](https://myst-nb.readthedocs.io) for more information.
2 changes: 1 addition & 1 deletion docs/content/figures.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Here is my figure caption!

:::{note}
You can also include figures that were generated by your code in notebooks.
To do so, see [](content:code-outputs:glue).
To do so, see [](content:executable:output-insert).
:::

## Markdown figures
Expand Down
2 changes: 1 addition & 1 deletion docs/content/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Then, you may use the `{numref}` role in the same way that you use it for Figure

If you wish to use Markdown style syntax, then MyST Markdown will try to find a reference from any of the above reference types (and more!).

This has an advantage, in that you can used nested markdown syntax in your text, for example:
This has an advantage, in that you can use nested markdown syntax in your text, for example:

```{example}

Expand Down
2 changes: 1 addition & 1 deletion docs/contribute/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ what kinds of functionality they support:
{term}`the MyST-Parser<MyST-Parser>`.
* {term}`The MyST-NB package<MyST-NB>` parses Jupyter Notebooks into Sphinx and also
controls some parts of notebook execution.
It also allows [inserting code outputs into content](content:code-outputs:glue).
It also allows [inserting code outputs into content](content:executable:output-insert).
* {term}`Jupyter-Cache` manages the execution and cacheing of notebook content at
build time. It is controlled by {term}`MyST-NB`.
* The {term}`Sphinx Book Theme` defines the look and feel of Jupyter Book, and is
Expand Down
Loading