Skip to content

Commit 569328c

Browse files
authored
Write JB2 post and add noxfile (#539)
1 parent e9bc7d4 commit 569328c

File tree

4 files changed

+176
-0
lines changed

4 files changed

+176
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@ This website is **hosted** by GitHub Pages, and we use Netlify to display previe
99

1010
## How to edit, build, and preview this website
1111

12+
### Using nox (recommended)
13+
14+
This project includes nox automation for building and previewing the website:
15+
16+
First [install nox](https://nox.thea.codes/en/stable/tutorial.html#installation).
17+
Then:
18+
19+
```bash
20+
# Build the website
21+
nox -s docs
22+
23+
# Build and serve with live reload at http://localhost:1313
24+
nox -s docs-live
25+
```
26+
27+
The nox sessions will automatically download Hugo Extended v0.125.3 from GitHub releases on first run and cache it for subsequent runs. To force a clean rebuild, use `nox -s docs --no-reuse-existing-virtualenvs`.
28+
29+
### Manual Hugo usage
30+
1231
See [the Team Compass blog documentation](https://compass.2i2c.org/communication/blog/) for more information.
1332

1433
## Blogging
117 KB
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Refactoring Jupyter Book 2 documentation ahead of a major release
3+
date: 2025-11-01
4+
authors:
5+
- Chris Holdgraf
6+
categories:
7+
- upstream-impact
8+
tags:
9+
- update
10+
- open-source
11+
- jupyterbook
12+
- learning
13+
- community
14+
---
15+
16+
Documentation is what turns open source code into products that people actually want to use. We recently spent a few days refactoring the [Jupyter Book](../../../collaborators/jupyter-book/) documentation to prepare for the upcoming Jupyter Book 2 release, and we're excited about how much clearer the docs have become!
17+
18+
## What we did
19+
20+
We restructured the docs using the [Diataxis framework](https://diataxis.fr/) to better organize content by user type and task:
21+
22+
- Reorganized into clear topic areas with landing pages for easier navigation
23+
- Added missing content like the feature voting table and contributing guides
24+
- Created upgrade guidance to help users understand the relationship between Jupyter Book 2 and MyST
25+
26+
This work helps users find what they need faster and gives the project a stronger foundation to build on going forward.
27+
28+
## Why we're excited about it
29+
30+
Better documentation reduces maintainer burden by helping users answer their own questions, and it makes the project more welcoming and useful to new contributors. We hope this makes Jupyter Book more accessible to everyone and lays a good foundation for the new release!
31+
32+
We're also excited because so many others helped provide edits and comments!
33+
34+
## Learn more
35+
36+
- [PR implementing the refactor](https://github.com/jupyter-book/jupyter-book/pull/2422)
37+
- [Documentation principles we developed](https://github.com/jupyter-book/jupyter-book/blob/next/docs/contribute/docs.md)
38+
- [Jupyter Book 2 documentation](https://next.jupyterbook.org)
39+
40+
## Acknowledgements
41+
42+
- Thanks to [@rlanzafame](https://github.com/rlanzafame), [@FreekPols](https://github.com/FreekPols), and [@bsipocz](https://github.com/bsipocz) for their helpful reviews, edits, and feedback on the PR!
43+
- [Project Pythia](../../../collaborators/pythia/), [CryoCloud](../../../collaborators/cryocloud/), and the Berkeley educational projects are our primary member communities using MyST and [Jupyter Book](../../../collaborators/jupyter-book/). Their support covers the cost of these kinds of foundational contributions.

noxfile.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
"""Nox sessions for building and serving the Hugo documentation site."""
2+
3+
import platform
4+
import tarfile
5+
import urllib.request
6+
from pathlib import Path
7+
8+
import nox
9+
10+
# Hugo version to download from GitHub releases
11+
HUGO_VERSION = "0.125.3"
12+
13+
nox.options.default_venv_backend = "uv"
14+
nox.options.reuse_existing_virtualenvs = True
15+
16+
17+
@nox.session(name="docs")
18+
def docs(session):
19+
"""Build the Hugo documentation site.
20+
21+
Downloads Hugo Extended v{HUGO_VERSION} from GitHub releases if not cached.
22+
"""
23+
hugo_path = install_hugo(session)
24+
25+
# Build the site
26+
session.run(hugo_path, external=True)
27+
28+
29+
@nox.session(name="docs-live")
30+
def docs_live(session):
31+
"""Build and serve the Hugo documentation site with live reload.
32+
33+
Downloads Hugo Extended v{HUGO_VERSION} from GitHub releases if not cached.
34+
The site will be available at http://localhost:1313
35+
"""
36+
hugo_path = install_hugo(session)
37+
38+
# Serve the site with live reload
39+
session.run(hugo_path, "server", external=True)
40+
41+
42+
def get_hugo_download_url(version):
43+
"""Get the download URL for Hugo based on the current platform."""
44+
system = platform.system().lower()
45+
machine = platform.machine().lower()
46+
47+
if system == "darwin":
48+
# macOS uses universal binary
49+
filename = f"hugo_extended_{version}_darwin-universal.tar.gz"
50+
elif system == "linux":
51+
if machine in ("x86_64", "amd64"):
52+
filename = f"hugo_extended_{version}_linux-amd64.tar.gz"
53+
elif machine in ("arm64", "aarch64"):
54+
filename = f"hugo_extended_{version}_linux-arm64.tar.gz"
55+
else:
56+
raise RuntimeError(f"Unsupported Linux architecture: {machine}")
57+
elif system == "windows":
58+
if machine in ("x86_64", "amd64"):
59+
filename = f"hugo_extended_{version}_windows-amd64.zip"
60+
else:
61+
raise RuntimeError(f"Unsupported Windows architecture: {machine}")
62+
else:
63+
raise RuntimeError(f"Unsupported operating system: {system}")
64+
65+
base_url = "https://github.com/gohugoio/hugo/releases/download"
66+
return f"{base_url}/v{version}/{filename}"
67+
68+
69+
def install_hugo(session):
70+
"""Download and install Hugo if not already present in the session."""
71+
# Create a bin directory in the session's virtualenv
72+
bin_dir = Path(session.virtualenv.location) / "bin"
73+
bin_dir.mkdir(exist_ok=True)
74+
hugo_path = bin_dir / "hugo"
75+
76+
# Check if Hugo is already installed in this session
77+
if hugo_path.exists():
78+
session.log(f"Hugo already installed at {hugo_path}")
79+
# Verify it's the correct version
80+
result = session.run(
81+
str(hugo_path), "version", silent=True, external=True
82+
)
83+
if HUGO_VERSION in result:
84+
session.log(f"Using cached Hugo {HUGO_VERSION}")
85+
return str(hugo_path)
86+
else:
87+
session.log("Cached Hugo version mismatch, re-downloading...")
88+
hugo_path.unlink()
89+
90+
# Download Hugo
91+
download_url = get_hugo_download_url(HUGO_VERSION)
92+
session.log(f"Downloading Hugo {HUGO_VERSION} from {download_url}")
93+
94+
download_path = bin_dir / "hugo.tar.gz"
95+
urllib.request.urlretrieve(download_url, download_path)
96+
97+
# Extract Hugo binary
98+
session.log("Extracting Hugo binary...")
99+
with tarfile.open(download_path, "r:gz") as tar:
100+
# Extract only the hugo binary
101+
for member in tar.getmembers():
102+
if member.name == "hugo":
103+
member.name = "hugo"
104+
tar.extract(member, path=bin_dir)
105+
break
106+
107+
# Make executable
108+
hugo_path.chmod(0o755)
109+
110+
# Clean up downloaded archive
111+
download_path.unlink()
112+
113+
session.log(f"Hugo {HUGO_VERSION} installed successfully at {hugo_path}")
114+
return str(hugo_path)

0 commit comments

Comments
 (0)