Skip to content

Commit 8437480

Browse files
committed
Docs: update theme, resolve warnings
1 parent e02b171 commit 8437480

File tree

4 files changed

+135
-42
lines changed

4 files changed

+135
-42
lines changed

docs/conf.py

Lines changed: 126 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,18 @@
2525
# Add any Sphinx extension module names here, as strings. They can be
2626
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2727
# ones.
28-
extensions = ["sphinx.ext.autodoc", "sphinx.ext.graphviz", "sphinx_copybutton"]
28+
extensions = [
29+
"sphinx.ext.autodoc",
30+
"sphinx.ext.graphviz",
31+
"sphinx_copybutton",
32+
"sphinx_colorschemed_images",
33+
]
2934

3035
# Add any paths that contain templates here, relative to this directory.
3136
# templates_path = ["_templates"]
3237

3338
# The suffix of source filenames.
34-
source_suffix = ".rst"
39+
source_suffix = {'.rst': 'restructuredtext'}
3540

3641
# The encoding of source files.
3742
# source_encoding = 'utf-8-sig'
@@ -47,10 +52,21 @@
4752
# |version| and |release|, also used in various other places throughout the
4853
# built documents.
4954
#
55+
# ---------------------------------------------------------------------
56+
# Versions.
5057
# The short X.Y version.
5158
version = "3.0.48"
5259
# The full version, including alpha/beta/rc tags.
5360
release = "3.0.48"
61+
# The URL pattern to match releases to ReadTheDocs URLs.
62+
docs_fmt_url = "https://python-prompt-toolkit.readthedocs.io/en/{release}/"
63+
# The list of releases to include in the dropdown.
64+
releases = [
65+
"latest",
66+
release,
67+
"2.0.9",
68+
"1.0.15",
69+
]
5470

5571
# The language for content autogenerated by Sphinx. Refer to documentation
5672
# for a list of supported languages.
@@ -82,8 +98,7 @@
8298
# show_authors = False
8399

84100
# The name of the Pygments (syntax highlighting) style to use.
85-
pygments_style = "pastie"
86-
pygments_dark_style = "dracula"
101+
# pygments_style = "pastie" # Provided as a theme option below.
87102

88103
# A list of ignored prefixes for module index sorting.
89104
# modindex_common_prefix = []
@@ -107,38 +122,113 @@
107122

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

110-
try:
111-
import sphinx_nefertiti
112-
113-
html_theme = "sphinx_nefertiti"
114-
html_theme_path = [sphinx_nefertiti.get_html_theme_path()]
115-
html_theme_options = {
116-
# "style" can take the following values: "blue", "indigo", "purple",
117-
# "pink", "red", "orange", "yellow", "green", "tail", and "default".
118-
"style": "default",
119-
# Fonts are customizable (and are not retrieved online).
120-
# https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/customization/fonts.html
121-
# "documentation_font": "Open Sans",
122-
# "monospace_font": "Ubuntu Mono",
123-
# "monospace_font_size": "1.1rem",
124-
"logo": "logo_400px.png",
125-
"logo_alt": "python-prompt-toolkit",
126-
"logo_width": "36",
127-
"logo_height": "36",
128-
"repository_url": "https://github.com/prompt-toolkit/python-prompt-toolkit",
129-
"repository_name": "python-prompt-toolkit",
130-
"footer_links": ",".join(
131-
[
132-
"Documentation|https://python-prompt-toolkit.readthedocs.io/",
133-
"Package|https://pypi.org/project/prompt-toolkit/",
134-
"Repository|https://github.com/prompt-toolkit/python-prompt-toolkit",
135-
"Issues|https://github.com/prompt-toolkit/python-prompt-toolkit/issues",
136-
]
137-
),
138-
}
139-
140-
except ImportError:
141-
html_theme = "pyramid"
125+
html_theme = "sphinx_nefertiti"
126+
# html_theme_path = [sphinx_nefertiti.get_html_theme_path()]
127+
html_theme_options = {
128+
"documentation_font": "Open Sans",
129+
"monospace_font": "Ubuntu Mono",
130+
"monospace_font_size": "1.1rem",
131+
132+
# "style" can take the following values: "blue", "indigo", "purple",
133+
# "pink", "red", "orange", "yellow", "green", "tail", and "default".
134+
"style": "blue",
135+
"pygments_light_style": "pastie",
136+
"pygments_dark_style": "dracula",
137+
138+
# Fonts are customizable (and are not retrieved online).
139+
# https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/customization/fonts.html
140+
"logo": "logo_400px.png",
141+
"logo_alt": "python-prompt-toolkit",
142+
"logo_width": "36",
143+
"logo_height": "36",
144+
"repository_url": "https://github.com/prompt-toolkit/python-prompt-toolkit",
145+
"repository_name": "python-prompt-toolkit",
146+
"current_version": "latest",
147+
"versions": [
148+
(item, docs_fmt_url.format(release=item)) for item in releases
149+
],
150+
"header_links": [
151+
{
152+
"text": "Getting started",
153+
"link": "pages/getting_started"
154+
},
155+
{
156+
"text": "Tutorials",
157+
"match": "/tutorials/*",
158+
"dropdown": (
159+
{
160+
"text": "Build an SQLite REPL",
161+
"link": "pages/tutorials/repl"
162+
},
163+
)
164+
},
165+
{
166+
"text": "Advanced",
167+
"link": "pages/advanced_topics/index",
168+
"match": "/advanced_topics/*",
169+
"dropdown": (
170+
{
171+
"text": "More about key bindings",
172+
"link": "pages/advanced_topics/key_bindings",
173+
},
174+
{
175+
"text": "More about styling",
176+
"link": "pages/advanced_topics/styling",
177+
},
178+
{
179+
"text": "Filters",
180+
"link": "pages/advanced_topics/filters",
181+
},
182+
{
183+
"text": "The rendering flow",
184+
"link": "pages/advanced_topics/rendering_flow",
185+
},
186+
{
187+
"text": "Running on top of the asyncio event loop",
188+
"link": "pages/advanced_topics/asyncio",
189+
},
190+
{
191+
"text": "Unit testing",
192+
"link": "pages/advanced_topics/unit_testing",
193+
},
194+
{
195+
"text": "Input hooks",
196+
"link": "pages/advanced_topics/input_hooks",
197+
},
198+
{
199+
"text": "Architecture",
200+
"link": "pages/advanced_topics/architecture",
201+
},
202+
{
203+
"text": "The rendering pipeline",
204+
"link": "pages/advanced_topics/rendering_pipeline"
205+
}
206+
)
207+
},
208+
{
209+
"text": "Reference",
210+
"link": "pages/reference",
211+
},
212+
],
213+
"footer_links": [
214+
{
215+
"text": "Documentation",
216+
"link": "https://python-prompt-toolkit.readthedocs.io/",
217+
},
218+
{
219+
"text": "Package",
220+
"link": "https://pypi.org/project/prompt-toolkit/",
221+
},
222+
{
223+
"text": "Repository",
224+
"link": "https://github.com/prompt-toolkit/python-prompt-toolkit",
225+
},
226+
{
227+
"text": "Issues",
228+
"link": "https://github.com/prompt-toolkit/python-prompt-toolkit/issues",
229+
}
230+
]
231+
}
142232

143233

144234
# Theme options are theme-specific and customize the look and feel of a theme

docs/pages/reference.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,11 @@ Filters
301301

302302
.. autoclass:: prompt_toolkit.filters.Filter
303303
:members:
304+
:no-index:
304305

305306
.. autoclass:: prompt_toolkit.filters.Condition
306307
:members:
308+
:no-index:
307309

308310
.. automodule:: prompt_toolkit.filters.utils
309311
:members:
@@ -334,7 +336,7 @@ Eventloop
334336

335337
.. automodule:: prompt_toolkit.eventloop
336338
:members: run_in_executor_with_context, call_soon_threadsafe,
337-
get_traceback_from_context, get_event_loop
339+
get_traceback_from_context
338340

339341
.. automodule:: prompt_toolkit.eventloop.inputhook
340342
:members:

docs/requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Sphinx<7
1+
Sphinx>=8,<9
22
wcwidth<1
33
pyperclip<2
4-
sphinx_copybutton>=0.5.0,<1.0.0
5-
sphinx-nefertiti>=0.2.1
4+
sphinx-colorschemed-images>=0.2.2
5+
sphinx_copybutton>=0.5.2,<1.0.0
6+
sphinx-nefertiti>=0.6.0

src/prompt_toolkit/application/current.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def create_app_session(
143143
"""
144144
Create a separate AppSession.
145145
146-
This is useful if there can be multiple individual `AppSession`s going on.
147-
Like in the case of an Telnet/SSH server.
146+
This is useful if there can be multiple individual ``AppSession``'s going
147+
on. Like in the case of a Telnet/SSH server.
148148
"""
149149
# If no input/output is specified, fall back to the current input/output,
150150
# if there was one that was set/created for the current session.

0 commit comments

Comments
 (0)