Skip to content

Commit

Permalink
Merge branch 'master' into agoose77/maint-update-entry-points
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Sep 24, 2024
2 parents e001397 + 1088750 commit 44fcde5
Show file tree
Hide file tree
Showing 55 changed files with 705 additions and 585 deletions.
2 changes: 1 addition & 1 deletion .binder/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ipywidgets
jupytext
matplotlib
nbclient
numpy
numpy>=2
pandas
plotly
sphinx-click
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scheduled_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
schedule:
# Run at the beginning of each day
- cron: '0 0 * * *'

workflow_dispatch:
jobs:

tests-windows:
Expand All @@ -14,7 +14,7 @@ jobs:
matrix:
# Using the default python in the Windows 2022 github actions runner
# ref: https://github.com/actions/virtual-environments/issues/4856
python-version: [3.9]
python-version: [3.10]

steps:
- uses: actions/checkout@v4
Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.py') }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.py') }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
# Install libmagic to avoid a flaky Fonts error with matplotlib
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ jobs:
# for some reason the tests/conftest.py::check_nbs fixture breaks pytest-cov's cov-report outputting
# this is why we run `coverage xml` afterwards (required by codecov)

# TEMPORARY FIX: Disable codecov until we can get it working again
- name: Upload to Codecov
if: github.repository == 'executablebooks/jupyter-book'
if: (github.repository == 'executablebooks/jupyter-book') && false
uses: codecov/codecov-action@v3.1.4
with:
name: ebp-jupyter-book-pytests-py3.9
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ Jupyter Book allows users to
* a publication-quality PDF.

## Governance of this project

Jupyter Book is still developing relatively rapidly, so please be patient if things change
or features iterate and change quickly. Once Jupyter Book hits 1.0, it will slow down
considerably!
Jupyter Book 1.x is now in a maintenance phase, where new feature requests have lower priority than bugfixes. Jupyter Book 2.x will be built on the new [MyST-MD document engine](https://mystmd.org/). See [our blog post](https://executablebooks.org/en/latest/blog/2024-05-20-jupyter-book-myst/) for more information.

## Contribute or improve the book

Expand Down
7 changes: 4 additions & 3 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ html:
# FIXME: surely we could allow internal or relative links somehow?
# (The documentation says only that HTML is allowed, nothing about the base URL is mentioned.)
# Then we could link to the changelog in the *same* build of the docs.
announcement: '⚠️The 0.13 release refactored our HTML, so double-check your custom CSS rules!⚠️'
announcement: >
ℹ️ Jupyter Book is being rebuilt on top of <a href="https://mystmd.org/">MyST-MD</a>.
See <a href="https://executablebooks.org/en/latest/blog/2024-05-20-jupyter-book-myst/">our blog post</a> for more information. 🚀
favicon: images/favicon.ico
google_analytics_id: UA-52617120-7
home_page_in_navbar: false
use_edit_page_button: true
use_repository_button: true
use_issues_button: true
baseurl: https://jupyterbook.org/
analytics:
google_analytics_id = ''
google_analytics_id: UA-52617120-7

repository:
url: https://github.com/executablebooks/jupyter-book
Expand Down
21 changes: 14 additions & 7 deletions docs/advanced/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Analytics) into the following directive in your configuration file:

```yaml
html:
google_analytics_id: G-XXXXXXX
analytics:
google_analytics_id: G-XXXXXXX
```
:::{seealso}
Expand All @@ -143,15 +144,21 @@ html:
[Plausible Analytics](https://plausible.io) is a lightweight, open source, [privacy-focused](https://plausible.io/privacy-focused-web-analytics) analytics service that can be used as a more ethical alternative (or, in addition to) to Google Analytics.
You can do this by adding the following in your configuration file:
Plausible Analytics requires a _domain_, which is given by the `plausible_analytics_domain` property:
```yaml
sphinx:
config:
html_js_files: [ ['https://plausible.io/js/script.js', {'defer': 'defer', 'data-domain': 'yourdomain.com'}] ]
html:
analytics:
plausible_analytics_domain: my-domain
```
You can specify the analytics script that is loaded; by default, the bundle from <https://plausible.io> is used:
```yaml
html:
analytics:
plausible_analytics_domain: my-domain
plausible_analytics_url: https://plausible.io/js/script.js
```

This should inject the appropriate code into the `<head>` via javascript, and you will be able to get analytics on your website through either the commercial company-hosted dashboard, or a [self-hosted instance](https://plausible.io/docs/self-hosting).
This should inject the appropriate code into the built site, and you will be able to get analytics on your website through either the commercial company-hosted dashboard, or a [self-hosted instance](https://plausible.io/docs/self-hosting).


(html:link-check)=
Expand Down
2 changes: 2 additions & 0 deletions docs/content/executable/output-insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ to focus on the glueing part.
# Simulate some data and bootstrap the mean of the data
import numpy as np
np.set_printoptions(legacy="1.25")
import pandas as pd
import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion docs/content/myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ MyST in Jupyter, and then build your book with Jupyter Book.

For working with Jupyter notebook and Markdown files, we recommend [jupytext](https://jupytext.readthedocs.io/en/latest),
an open source tool for two-way conversion between `.ipynb` and text files.
Jupytext [supports the MyST Markdown format](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown).
Jupytext [supports the MyST Markdown format](https://jupytext.readthedocs.io/en/latest/formats-markdown.html#myst-markdown).

:::{note}
For full compatibility with `myst-parser`, it is necessary to use `jupytext>=1.6.0`.
Expand Down
2 changes: 1 addition & 1 deletion docs/file-types/jupytext.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ This mapping allows for "true" error reporting, as described in [](inv:myst-nb#m

[Jupytext](https://jupytext.readthedocs.io/en/latest/) is an excellent Python tool for two-way conversion
between Jupyter Notebook `.ipynb` files and
[a variety of text-based files](https://jupytext.readthedocs.io/en/latest/formats.html).
[a variety of text-based files](https://jupytext.readthedocs.io/en/latest/formats-markdown.html).

Jupyter Book natively supports the Jupytext file format: [notebooks with MyST Markdown](./myst-notebooks.md).

Expand Down
4 changes: 2 additions & 2 deletions docs/interactive/launchbuttons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"```\n",
"\n",
"One thing to take into account when choosing the interface is that notebooks written in the [MyST Markdown](../file-types/myst-notebooks.md) text-based format will not be opened as notebooks out-of-the-box.\n",
" If you wish for these files to be opened as notebooks then firstly you must ensure that [`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown) is installed in the Binder/JupyterHub environment for your book (no support for this feature exists in Google Colab).\n",
" If you wish for these files to be opened as notebooks then firstly you must ensure that [`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats-markdown.html#myst-markdown) is installed in the Binder/JupyterHub environment for your book (no support for this feature exists in Google Colab).\n",
"You then have two options:\n",
"\n",
"- Use the \"classic\" interface, which will then immediately open these files as notebooks.\n",
Expand Down Expand Up @@ -113,7 +113,7 @@
"[`nbgitpuller`](https://jupyterhub.github.io/nbgitpuller/). \n",
"\n",
"2. To open myst-markdown as notebooks, the server needs\n",
"[`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown). \n",
"[`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats-markdown.html#myst-markdown). \n",
"\n",
"You can add the following line to your `DockerFile`:\n",
"```\n",
Expand Down
2 changes: 1 addition & 1 deletion jupyter_book/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Build a book with Jupyter Notebooks and Sphinx."""

__version__ = "1.0.0"
__version__ = "1.0.2"


# We connect this function to the step after the builder is initialized
Expand Down
29 changes: 25 additions & 4 deletions jupyter_book/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A small sphinx extension to let you configure a site with YAML metadata."""

import json
import sys
from functools import lru_cache
Expand Down Expand Up @@ -36,6 +37,7 @@ def get_default_sphinx_config():
"sphinx_external_toc",
"sphinx.ext.intersphinx",
"sphinx_design",
"sphinx_book_theme",
],
pygments_style="sphinx",
html_theme="sphinx_book_theme",
Expand Down Expand Up @@ -297,10 +299,29 @@ def yaml_to_sphinx(yaml: dict):
if yml_key in html:
theme_options[spx_key] = html[yml_key]

for spx_key, yml_key in [("google_analytics_id", "google_analytics_id")]:
if yml_key in html:
theme_options["analytics"] = {}
theme_options["analytics"][spx_key] = html[yml_key]
# Fix for renamed field
spx_analytics = theme_options["analytics"] = {}
google_analytics_id = html.get("google_analytics_id")
if google_analytics_id is not None:
_message_box(
(
"[Warning] The `html.google_analytics_id` configuration value has moved to `html.analytics.google_analytics_id`" # noqa: E501
),
color="orange",
print_func=print,
)
spx_analytics["google_analytics_id"] = google_analytics_id

# Analytics
yml_analytics = html.get("analytics", {})
for spx_key, yml_key in [
("google_analytics_id", "google_analytics_id"),
("plausible_analytics_domain", "plausible_analytics_domain"),
("plausible_analytics_url", "plausible_analytics_url"),
]:
if yml_key in yml_analytics:
spx_analytics[spx_key] = yml_analytics[yml_key]

# Pass through the buttons
btns = ["use_repository_button", "use_edit_page_button", "use_issues_button"]
use_buttons = {btn: html.get(btn) for btn in btns if btn in html}
Expand Down
Loading

0 comments on commit 44fcde5

Please sign in to comment.