Skip to content

Commit

Permalink
fix docs theme
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Dec 14, 2023
1 parent a89f9c4 commit c3527d9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docsbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install . sphinx sphinx-rtd-theme
pip install doc/src/requirements.txt
- name: Build documentation
run: |
cd doc
make html
make html
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build:

python:
install:
- requirements: docs/source/requirements.txt
- method: pip
path: .

Expand Down
31 changes: 9 additions & 22 deletions doc/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
from datetime import date
import tomli

on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# -- Project information -----------------------------------------------------

project = "pdm-build-locked"
copyright = "2023, sigma67"
author = "sigma67"
# -- Project information -----------------------------------------------------
with open("../../pyproject.toml", "rb") as pyproject:
pyproject_toml = tomli.load(pyproject)["project"]
project = pyproject_toml["name"]
author = ", ".join(author["name"] for author in pyproject_toml["authors"])
copyright = f"{date.today().year}, pdm-project"

# -- General configuration ---------------------------------------------------

Expand All @@ -41,21 +45,4 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
if not on_rtd:
# Try to use the ReadTheDocs theme if installed.
# Default to the default alabaster theme if not.
try:
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
html_theme = "alabaster"
else:
# Set theme to 'default' for ReadTheDocs.
html_theme = "default"
html_theme = "sphinx_rtd_theme"
3 changes: 3 additions & 0 deletions doc/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx<7
sphinx-rtd-theme
tomli
5 changes: 2 additions & 3 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dev = [
doc = [
"sphinx>=7.1.2",
"sphinx-rtd-theme>=2.0.0",
"tomli>=2.0.1",
]

[tool.ruff]
Expand Down

0 comments on commit c3527d9

Please sign in to comment.