Skip to content

Commit 32dfa97

Browse files
committed
sphinx material
1 parent 48cbf79 commit 32dfa97

File tree

5 files changed

+158
-46
lines changed

5 files changed

+158
-46
lines changed

.github/workflows/build-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: timeout 10s poetry run pip --version || rm -rf .venv
4141

4242
- name: Install dependencies
43-
run: poetry install
43+
run: poetry install -E docs
4444

4545
- name: Build documentation
4646
run: |

.readthedocs.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ sphinx:
1010
formats: all
1111

1212
python:
13-
version: 3.7
13+
version: 3.8
1414
install:
1515
- method: pip
1616
path: .
17+
extra_requirements:
18+
- docs

docs/conf.py

+48-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"sphinx.ext.intersphinx",
3838
"sphinx.ext.coverage",
3939
"sphinx.ext.viewcode",
40+
"sphinx_immaterial",
4041
]
4142

4243
# Add any paths that contain templates here, relative to this directory.
@@ -53,9 +54,55 @@
5354
# The theme to use for HTML and HTML Help pages. See the documentation for
5455
# a list of builtin themes.
5556
#
56-
html_theme = "sphinx_rtd_theme"
57+
html_theme = "sphinx_immaterial"
5758

5859
# Add any paths that contain custom static files (such as style sheets) here,
5960
# relative to this directory. They are copied after the builtin static files,
6061
# so a file named "default.css" will overwrite the builtin "default.css".
6162
html_static_path = []
63+
64+
# Set link name generated in the top bar.
65+
html_title = "openapi-core"
66+
67+
# Material theme options (see theme.conf for more information)
68+
html_theme_options = {
69+
# Set you GA account ID to enable tracking
70+
# 'google_analytics_account': 'UA-XXXXX',
71+
# Specify a base_url used to generate sitemap.xml. If not
72+
# specified, then no sitemap will be built.
73+
#'base_url': 'https://project.github.io/project',
74+
# Set the color and the accent color
75+
# Set the repo location to get a badge with stats
76+
"repo_url": "https://github.com/p1c2u/openapi-core/",
77+
"repo_name": "openapi-core",
78+
"repo_type": "github",
79+
"icon": {
80+
"repo": "fontawesome/brands/github-alt",
81+
"edit": "material/file-edit-outline",
82+
},
83+
"palette": [
84+
{
85+
"media": "(prefers-color-scheme: dark)",
86+
"scheme": "slate",
87+
"primary": "lime",
88+
"accent": "amber",
89+
"scheme": "slate",
90+
"toggle": {
91+
"icon": "material/toggle-switch",
92+
"name": "Switch to light mode",
93+
},
94+
},
95+
{
96+
"media": "(prefers-color-scheme: light)",
97+
"scheme": "default",
98+
"primary": "lime",
99+
"accent": "amber",
100+
"toggle": {
101+
"icon": "material/toggle-switch-off-outline",
102+
"name": "Switch to dark mode",
103+
},
104+
},
105+
],
106+
# If False, expand all TOC entries
107+
"globaltoc_collapse": False,
108+
}

poetry.lock

+99-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ werkzeug = "*"
6666
typing-extensions = "^4.3.0"
6767
jsonschema-spec = "^0.1.1"
6868
backports-cached-property = {version = "^1.0.2", python = "<3.8" }
69+
sphinx = {version = "^5.3.0", optional = true}
70+
sphinx-immaterial = {version = "^0.11.0", optional = true}
6971

7072
[tool.poetry.extras]
73+
docs = ["sphinx", "sphinx-immaterial"]
7174
django = ["django"]
7275
falcon = ["falcon"]
7376
flask = ["flask"]
@@ -86,14 +89,16 @@ pytest = "^7"
8689
pytest-flake8 = "*"
8790
pytest-cov = "*"
8891
responses = "*"
89-
sphinx = "^5.3.0"
90-
sphinx-rtd-theme = "^1.2.0"
9192
strict-rfc3339 = "^0.7"
9293
webob = "*"
9394
mypy = "^1.0"
9495
starlette = "^0.25.0"
9596
httpx = "^0.23.3"
9697

98+
[tool.poetry.group.docs.dependencies]
99+
sphinx = "^5.3.0"
100+
sphinx-immaterial = "^0.11.0"
101+
97102
[tool.pytest.ini_options]
98103
addopts = """
99104
--capture=no

0 commit comments

Comments
 (0)