Skip to content

Commit c2927a2

Browse files
authored
Merge pull request #485 from jumpstarter-dev/backport-483-to-release-0.6
Backport #483 to release 0.6
2 parents 83b1c4c + 2703360 commit c2927a2

File tree

7 files changed

+31
-94
lines changed

7 files changed

+31
-94
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ cython_debug/
163163
#.idea/
164164

165165
# Ruff cache
166-
.ruff_cache/
166+
.ruff_cache/

docs/Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ serve:
2626
sphinx-autobuild --host $(HOST) --port $(PORT) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2727

2828
multiversion:
29-
sphinx-multiversion "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
30-
@if [ -d "$(BUILDDIR)/main" ]; then \
31-
echo "Moving main directory contents to build root"; \
32-
mv "$(BUILDDIR)/main/"* "$(BUILDDIR)/"; \
33-
rm -rf "$(BUILDDIR)/main/"; \
34-
fi
29+
./multiversion.sh
3530

3631
serve-multiversion:
3732
@echo "Serving multiversion documentation using the HOST variable"
38-
@cd "$(BUILDDIR)" && python -m http.server $(PORT) --bind $(HOST)
33+
@cd "$(BUILDDIR)" && python -m http.server $(PORT) --bind $(HOST)

docs/multiversion.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -euox pipefail
3+
4+
declare -a BRANCHES=("main" "release-0.5" "release-0.6")
5+
6+
# https://stackoverflow.com/a/246128
7+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8+
OUTPUT_DIR="${SCRIPT_DIR}/build"
9+
10+
rm -rf "${OUTPUT_DIR}"
11+
mkdir -p "${OUTPUT_DIR}"
12+
13+
for BRANCH in "${BRANCHES[@]}"; do
14+
WORKTREE="${OUTPUT_DIR}/.worktree/tmp-docs-${BRANCH}"
15+
16+
git worktree add --force "${WORKTREE}" "${BRANCH}"
17+
18+
uv run --project "${WORKTREE}" --isolated --all-packages --group docs \
19+
make -C "${WORKTREE}/docs" html SPHINXOPTS="-D version=${BRANCH}"
20+
21+
cp -r "${WORKTREE}/docs/build/html" "${OUTPUT_DIR}/${BRANCH}"
22+
23+
git worktree remove --force "${WORKTREE}"
24+
done
25+
26+
pushd "${OUTPUT_DIR}"
27+
uvx --from git+https://github.com/steinwurf/versjon --with jinja2 versjon
28+
popd

docs/source/_templates/sidebar/versions.html

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"sphinx.ext.doctest",
3030
"sphinx_click",
3131
"sphinx_substitution_extensions",
32-
"sphinx_multiversion",
3332
"sphinx_copybutton"
3433
]
3534

@@ -99,44 +98,13 @@ def get_index_url():
9998
"sidebar/scroll-start.html",
10099
"sidebar/navigation.html",
101100
"sidebar/scroll-end.html",
102-
"sidebar/versions.html",
103101
]
104102
}
105103
html_theme_options = {
106104
"sidebar_hide_name": True,
107105
"top_of_page_button": "edit",
108106
}
109107

110-
# -- sphinx-multiversion configuration -------------------------------------
111-
# This replaces the custom bash script approach with built-in functionality
112-
113-
# Tags pattern for html_context["versions"]
114-
smv_tag_whitelist = r"$^" # Ignore all tags
115-
smv_branch_whitelist = r"^(main|release-\d+\.\d+)$" # Include all release branches and main
116-
smv_remote_whitelist = r'^(origin|upstream)$' # Include branches from origin and upstream
117-
smv_prefer_remote_refs = True
118-
# smv_released_pattern = r"^v[0-9]+\.[0-9]+\.[0-9]+$" # Tags that are considered releases
119-
smv_outputdir_format = "{ref.name}" # Directory name format
120-
121-
# Ensure static files are copied to all versions
122-
smv_static_files = [
123-
"_static/**",
124-
"_templates/**",
125-
]
126-
127-
# Ensure RST directives are processed
128-
smv_include_patterns = [
129-
"*.md",
130-
"*.rst",
131-
"*.txt",
132-
]
133-
134-
# Patterns for the versions panel
135-
html_context = {
136-
"display_lower": True, # Display lower versions at the bottom of the menu
137-
"deploy_url": os.getenv("DEPLOY_URL", "https://docs.jumpstarter.dev"), # Get Netlify URL from environment variable
138-
}
139-
140108
# sphinx-copybutton config
141109
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
142110
copybutton_prompt_is_regexp = True

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ docs = [
4848
"sphinx-substitution-extensions>=2024.10.17",
4949
"requests>=2.32.3",
5050
"sphinxcontrib-programoutput>=0.18",
51-
"sphinx-multiversion>=0.2.4",
5251
"sphinx-copybutton>=0.5.2",
5352
]
5453
dev = [

uv.lock

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)