Skip to content

Commit 84e589d

Browse files
committed
Update documentation to use PyData theme [ci skip]
1 parent aa26d61 commit 84e589d

File tree

15 files changed

+159
-76
lines changed

15 files changed

+159
-76
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
related.rst

docs/_static/js/custom-icon.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*******************************************************************************
2+
* Set a custom icon for pypi as it's not available in the fa built-in brands
3+
*/
4+
FontAwesome.library.add(
5+
(faListOldStyle = {
6+
prefix: "fa-custom",
7+
iconName: "pypi",
8+
icon: [
9+
17.313, // viewBox width
10+
19.807, // viewBox height
11+
[], // ligature
12+
"e001", // unicode codepoint - private use area
13+
"m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z", // svg path (https://simpleicons.org/icons/pypi.svg)
14+
],
15+
}),
16+
);
17+
18+
FontAwesome.library.add(
19+
(faListOldStyle = {
20+
prefix: "fa-custom",
21+
iconName: "sword",
22+
icon: [
23+
256, // viewBox width
24+
256, // viewBox height
25+
[], // ligature
26+
"e002", // unicode codepoint - private use area
27+
"M221.65723,34.34326A8.00246,8.00246,0,0,0,216,32h-.02539l-63.79883.20117A8.00073,8.00073,0,0,0,146.0332,35.106L75.637,120.32275,67.31348,111.999A16.02162,16.02162,0,0,0,44.68555,112L32.001,124.68555A15.99888,15.99888,0,0,0,32,147.31348l20.88672,20.88769L22.94531,198.14258a16.01777,16.01777,0,0,0,.001,22.62695l12.28418,12.28418a16.00007,16.00007,0,0,0,22.62793,0L87.79883,203.1123,108.68652,224.001A16.02251,16.02251,0,0,0,131.31445,224L143.999,211.31445A15.99888,15.99888,0,0,0,144,188.68652l-8.32324-8.32324,85.21679-70.39648a8.00125,8.00125,0,0,0,2.90528-6.14258L224,40.02539A8.001,8.001,0,0,0,221.65723,34.34326Zm-13.84668,65.67822-83.49829,68.97706L111.314,156l54.34327-54.34277a8.00053,8.00053,0,0,0-11.31446-11.31446L100,144.686,87.00195,131.6875,155.97852,48.189l51.99609-.16357Z", // svg path (https://simpleicons.org/icons/pypi.svg)
28+
],
29+
}),
30+
);
31+
32+
FontAwesome.library.add(
33+
(faListOldStyle = {
34+
prefix: "fa-custom",
35+
iconName: "knife",
36+
icon: [
37+
256, // viewBox width
38+
256, // viewBox height
39+
[], // ligature
40+
"e003", // unicode codepoint - private use area
41+
"M231.79883,32.2002a28.05536,28.05536,0,0,0-39.667.06933L18.27441,210.41211a8,8,0,0,0,3.92676,13.38281,155.06019,155.06019,0,0,0,34.957,4.00293c33.4209-.001,66.877-10.86914,98.32813-32.1748,31.74512-21.50391,50.14551-45.79981,50.91406-46.82325a8.00114,8.00114,0,0,0-.74316-10.457L186.919,119.60547l44.97753-47.90332A28.03445,28.03445,0,0,0,231.79883,32.2002ZM189.207,144.52148a225.51045,225.51045,0,0,1-43.10351,38.13184c-34.46973,23.23145-69.999,32.665-105.83887,28.13477l106.29492-108.915,23.30176,23.30175q.208.22852.43847.44434l.082.07617Z", // svg path (https://simpleicons.org/icons/pypi.svg)
42+
],
43+
}),
44+
);

docs/_static/json/switcher.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"name": "v0.1 (latest)",
4+
"version": "0.1.2",
5+
"url": "https://pyskani.readthedocs.io/en/v0.1.2/"
6+
}
7+
]

docs/api/database.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ Database
33

44
.. currentmodule:: pyskani
55

6-
Sketch
7-
------
8-
96
.. autoclass:: pyskani.Database
107
:special-members: __init__
118
:inherited-members:

docs/api/hit.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
Database
2-
========
1+
Hit
2+
===
33

44
.. currentmodule:: pyskani
55

6-
Sketch
7-
------
8-
96
.. autoclass:: pyskani.Hit
107
:special-members: __init__
118
:inherited-members:

docs/api/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ The version of ``skani`` wrapped in this version of ``pyskani`` is
2222
.. toctree::
2323
:hidden:
2424

25-
database <database>
26-
sketch <sketch>
27-
hit <hit>
25+
Database <database>
26+
Sketch <sketch>
27+
Hit <hit>
2828

2929

3030
.. only:: html

docs/api/sketch.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
Database
2-
========
1+
Sketch
2+
======
33

44
.. currentmodule:: pyskani
55

6-
Sketch
7-
------
8-
96
.. autoclass:: pyskani.Sketch
107
:special-members: __init__
118
:inherited-members:

docs/conf.py

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import re
1313
import semantic_version
1414
import shutil
15-
import sphinx_bootstrap_theme
1615
import sys
16+
import urllib.request
1717

1818
# -- Path setup --------------------------------------------------------------
1919

@@ -24,6 +24,11 @@
2424
docssrc_dir = os.path.dirname(os.path.abspath(__file__))
2525
project_dir = os.path.dirname(docssrc_dir)
2626

27+
# Download the *See Also* cards from a centralized location so it can be kept
28+
# up-to-date across all projects
29+
with urllib.request.urlopen("https://gist.githubusercontent.com/althonos/5d6bf5a512d64dc951c42a91d5fc3fb3/raw/related.rst") as src:
30+
with open("related.rst", "wb") as dst:
31+
shutil.copyfileobj(src, dst)
2732

2833
# -- Project information -----------------------------------------------------
2934

@@ -40,15 +45,6 @@
4045
version = str(semver.truncate(level="patch"))
4146
release = str(semver)
4247

43-
# extract the project URLs from ``setup.cfg``
44-
cfgparser = configparser.ConfigParser()
45-
cfgparser.read(os.path.join(project_dir, "setup.cfg"))
46-
project_urls = dict(
47-
map(str.strip, line.split(" = ", 1))
48-
for line in cfgparser.get("metadata", "project_urls").splitlines()
49-
if line.strip()
50-
)
51-
5248
# patch the docstring so that we don't show the link to redirect
5349
# to the docs (we don't want to see it when reading the docs already, duh!)
5450
doc_lines = pyskani.__doc__.splitlines()
@@ -77,8 +73,9 @@
7773
"sphinx.ext.mathjax",
7874
"sphinx.ext.todo",
7975
"sphinx.ext.extlinks",
80-
"sphinx_bootstrap_theme",
8176
"recommonmark",
77+
"sphinx_design",
78+
"sphinxcontrib.jquery",
8279
#"nbsphinx",
8380
]
8481

@@ -102,67 +99,64 @@
10299
# The name of the default role for inline references
103100
default_role = "py:obj"
104101

105-
106-
107-
# The name of the default role for inline references
108-
default_role = "py:obj"
109-
110-
111102
# -- Options for HTML output -------------------------------------------------
112103

113104
# The theme to use for HTML and HTML Help pages. See the documentation for
114105
# a list of builtin themes.
115106
#
116-
html_theme = 'bootstrap'
107+
html_theme = 'pydata_sphinx_theme'
117108

118109
# Add any paths that contain custom static files (such as style sheets) here,
119110
# relative to this directory. They are copied after the builtin static files,
120111
# so a file named "default.css" will overwrite the builtin "default.css".
121-
html_static_path = ['_static']
112+
html_static_path = ['_static/js', '_static/bibtex', '_static/css', '_static/json']
113+
html_js_files = ["custom-icon.js"]
114+
html_css_files = ["custom.css"]
122115

123116
# Theme options are theme-specific and customize the look and feel of a theme
124117
# further. For a list of options available for each theme, see the
125118
# documentation.
126119
#
127120
html_theme_options = {
128-
# Bootswatch (http://bootswatch.com/) theme.
129-
"bootswatch_theme": "flatly",
130-
# Choose Bootstrap version.
131-
"bootstrap_version": "3",
132-
# Tab name for entire site. (Default: "Site")
133-
"navbar_site_name": "Documentation",
134-
# HTML navbar class (Default: "navbar") to attach to <div> element.
135-
# For black navbar, do "navbar navbar-inverse"
136-
"navbar_class": "navbar",
137-
# Render the next and previous page links in navbar. (Default: true)
138-
"navbar_sidebarrel": True,
139-
# Render the current pages TOC in the navbar. (Default: true)
140-
"navbar_pagenav": False,
141-
# A list of tuples containing pages or urls to link to.
142-
"navbar_links": [
143-
("GitHub", cfgparser.get("metadata", "home_page").strip(), True)
144-
] + [
145-
(k, v, True)
146-
for k, v in project_urls.items()
147-
if k in {"Zenodo", "PyPI"}
121+
"external_links": [],
122+
"show_toc_level": 2,
123+
"use_edit_page_button": True,
124+
"icon_links": [
125+
{
126+
"name": "GitHub",
127+
"url": "https://github.com/althonos/pyskani",
128+
"icon": "fa-brands fa-github",
129+
},
130+
{
131+
"name": "PyPI",
132+
"url": "https://pypi.org/project/pyskani",
133+
"icon": "fa-custom fa-pypi",
134+
},
148135
],
149-
"admonition_use_panel": True,
136+
"logo": {
137+
"text": "Pyskani",
138+
# "image_light": "_images/logo.png",
139+
# "image_dark": "_images/logo.png",
140+
},
141+
"navbar_start": ["navbar-logo", "version-switcher"],
142+
"navbar_align": "left",
143+
"footer_start": ["copyright"],
144+
"footer_center": ["sphinx-version"],
145+
"switcher": {
146+
"json_url": "https://pyskani.readthedocs.io/en/latest/_static/switcher.json",
147+
"version_match": version,
148+
}
150149
}
151150

152-
# Custom sidebar templates, must be a dictionary that maps document names
153-
# to template names.
154-
#
155-
# The default sidebars (for documents that don't match any pattern) are
156-
# defined by theme itself. Builtin themes are using these templates by
157-
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
158-
# 'searchbox.html']``.
159-
#
160-
html_sidebars = {
161-
"*": ["localtoc.html"],
162-
"api/*": ["localtoc.html"],
163-
"examples/*": ["localtoc.html"],
151+
html_context = {
152+
"github_user": "althonos",
153+
"github_repo": "pyskani",
154+
"github_version": "main",
155+
"doc_path": "docs",
164156
}
165157

158+
html_favicon = '_images/favicon.ico'
159+
166160
# -- Options for HTMLHelp output ---------------------------------------------
167161

168162
# Output file base name for HTML help builder.
@@ -196,7 +190,7 @@
196190
# Example configuration for intersphinx: refer to the Python standard library.
197191
intersphinx_mapping = {
198192
"python": ("https://docs.python.org/3/", None),
199-
"biopython": ("https://biopython.org/docs/latest/api/", None),
193+
"biopython": ("https://biopython.org/docs/latest/", None),
200194
}
201195

202196
# -- Options for recommonmark extension --------------------------------------

docs/guide/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CHANGELOG.md

docs/guide/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CONTRIBUTING.md

0 commit comments

Comments
 (0)