Skip to content

Commit 11a4f78

Browse files
committed
Initial commit of working docs versioning.
1 parent 4f054ca commit 11a4f78

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818

1919
- name: Build HTML
2020
uses: ammaraskar/sphinx-action@7.0.0
21+
with:
22+
build-command: "sphinx-multiversion source build/html"
2123

2224
- name: Upload artifacts
2325
uses: actions/upload-artifact@v4
@@ -30,4 +32,4 @@ jobs:
3032
if: github.ref == 'refs/heads/master'
3133
with:
3234
github_token: ${{ secrets.GITHUB_TOKEN }}
33-
publish_dir: docs/build/html
35+
publish_dir: docs/build/html/master

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinxawesome-theme==5.3.2
22
sphinx-autodoc-typehints==2.3.0
3+
sphinx-multiversion==0.2.4
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% if versions %}
2+
<h3>{{ _('Versions') }}</h3>
3+
<ul>
4+
{%- for item in versions %}
5+
<li><a href="{{ item.url }}">{{ item.name }}</a></li>
6+
{%- endfor %}
7+
</ul>
8+
{% endif %}

docs/source/conf.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = "Judge0 Python SDK"
1414
copyright = "2024, Judge0"
1515
author = "Judge0"
16-
release = "0.1"
16+
release = ""
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -23,19 +23,24 @@
2323
"sphinx.ext.napoleon",
2424
"sphinx.ext.autosummary",
2525
"sphinx_autodoc_typehints",
26+
"sphinx_multiversion",
2627
]
2728

2829
templates_path = ["_templates"]
2930
exclude_patterns = []
3031

31-
32-
# add_module_names = False
33-
3432
# -- Options for HTML output -------------------------------------------------
3533
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3634

3735
html_theme = "sphinxawesome_theme"
3836
html_show_sphinx = False
37+
html_sidebars = {
38+
"**": [
39+
"sidebar_main_nav_links.html",
40+
"sidebar_toc.html",
41+
"versioning.html",
42+
],
43+
}
3944

4045
sys.path.insert(0, os.path.abspath("../../src/")) # Adjust as needed
4146

@@ -50,3 +55,17 @@
5055
autodoc_mock_imports = ["requests", "pydantic"]
5156

5257
napoleon_google_docstring = False
58+
59+
# Whitelist pattern for tags (set to None to ignore all tags)
60+
smv_tag_whitelist = r"^.*$"
61+
# Whitelist pattern for branches (set to None to ignore all branches)
62+
smv_branch_whitelist = r"^master$"
63+
# Whitelist pattern for remotes (set to None to use local branches only)
64+
smv_remote_whitelist = None
65+
# Pattern for released versions
66+
smv_released_pattern = "" # r"^tags/.*$"
67+
# Format for versioned output directories inside the build directory
68+
smv_outputdir_format = "{ref.name}"
69+
# Determines whether remote or local git branches/tags are preferred if their
70+
# output dirs conflict
71+
smv_prefer_remote_refs = False

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You can run minimal Hello World example in three easy steps:
1515
1616
2. Create a minimal script:
1717

18-
.. code-block:: Python
18+
.. code-block:: python
1919
2020
import judge0
2121

0 commit comments

Comments
 (0)