changeset 367:b4185dc7b574

Update sphinx config to use numpy convention and custom css style
author Amine Sehili <amine.sehili@gmail.com>
date Sun, 03 Jan 2021 18:46:40 +0100
parents 0118e0e33267
children 683c98b7f5a6
files doc/_static/css/custom_style.css doc/conf.py doc/figures/auditok-logo-rtd.png
diffstat 3 files changed, 56 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/_static/css/custom_style.css	Sun Jan 03 18:46:40 2021 +0100
@@ -0,0 +1,29 @@
+div.wy-side-nav-search .version {
+    color: #DDDDDD;
+    font-weight: bold;
+}
+
+nav.wy-nav-top {
+    background: #343131;
+}
+
+div.wy-nav-content {
+    max-width: 980px;
+}
+
+span.caption-text {
+    color: #45ea77;
+    font-size: 1.1em;
+    font-family: Arial, Helvetica, sans-serif;
+}
+
+.toctree-wrapper span.caption-text  {
+    color: #e4188b;
+    font-size: 1.1em;
+    font-family: Arial, Helvetica, sans-serif;
+}
+
+h1, h2 {
+
+    font-family: Arial, Helvetica, sans-serif;
+}
--- a/doc/conf.py	Sun Jan 03 15:28:13 2021 +0100
+++ b/doc/conf.py	Sun Jan 03 18:46:40 2021 +0100
@@ -14,6 +14,8 @@
 
 import sys
 import os
+import re
+import ast
 import shlex
 
 # If extensions (or modules to document with autodoc) are in another directory,
@@ -30,12 +32,21 @@
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
 extensions = [
+    "sphinx.ext.napoleon",
     "sphinx.ext.viewcode",
     "sphinx.ext.autodoc",
     "sphinx.ext.autosummary",
 ]
+autosummary_generate = True
 
-sys.path.insert(0, "../auditok/")
+_version_re = re.compile(r"__version__\s+=\s+(.*)")
+
+with open("../auditok/__init__.py", "rt") as f:
+    version = str(ast.literal_eval(_version_re.search(f.read()).group(1)))
+    release = "v" + version
+
+
+sys.path.insert(0, "../")
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ["_templates"]
@@ -53,7 +64,7 @@
 
 # General information about the project.
 project = u"auditok"
-copyright = u"2015-2016, Amine Sehili"
+copyright = u"2015-2021, Amine Sehili"
 author = u"Amine Sehili"
 
 # The version info for the project you're documenting, acts as replacement for
@@ -61,9 +72,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = "0.1.5"
+# version = "0.2.0"
 # The full version, including alpha/beta/rc tags.
-release = "0.1.5"
+# release = "0.2.0"
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -119,10 +130,15 @@
 
 # on_rtd is whether we are on readthedocs.org
 on_rtd = os.environ.get("READTHEDOCS", None) == "True"
-# if not on_rtd:  # only import and set the theme if we're building docs locally
-#    import sphinx_rtd_theme
-#    html_theme = 'sphinx_rtd_theme'
-#    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+if not on_rtd:  # only import and set the theme if we're building docs locally
+    import sphinx_rtd_theme
+
+    html_theme = "sphinx_rtd_theme"
+    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+html_theme_options = {
+    "logo_only": True,
+    "style_nav_header_background": "black",
+}
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
@@ -141,7 +157,7 @@
 
 # The name of an image file (relative to this directory) to place at the top
 # of the sidebar.
-# html_logo = None
+html_logo = "figures/auditok-logo-rtd.png"
 
 # The name of an image file (within the static path) to use as favicon of the
 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -152,6 +168,7 @@
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
 html_static_path = ["_static"]
+html_css_files = ["css/custom_style.css"]
 
 # Add any extra paths that contain custom files (such as robots.txt or
 # .htaccess) here, relative to this directory. These files are copied
@@ -285,7 +302,7 @@
         u"auditok Documentation",
         author,
         "auditok",
-        "One line description of project.",
+        "Audio Activity Detection tool.",
         "Miscellaneous",
     ),
 ]
Binary file doc/figures/auditok-logo-rtd.png has changed