import datetime
import os
import sys
import re
import shutil
import urllib.request
import semantic_version
docssrc_dir = os.path.dirname(os.path.abspath(__file__))
project_dir = os.path.dirname(os.path.dirname(docssrc_dir))
if os.getenv("READTHEDOCS", "False") != "True":
sys.path.insert(0, project_dir)
with urllib.request.urlopen("https://gist.githubusercontent.com/althonos/5d6bf5a512d64dc951c42a91d5fc3fb3/raw/related.rst") as src:
with open("related.rst", "wb") as dst:
shutil.copyfileobj(src, dst)
import lightmotif
project = lightmotif.__name__
author = re.match('(.*) <.*>', lightmotif.__author__).group(1)
year = datetime.date.today().year
copyright = '{}, {}'.format("2023" if year==2023 else "2023-{}".format(year), author)
semver = semantic_version.Version.coerce(lightmotif.__version__)
version = str(semver.truncate(level="patch"))
release = str(semver)
doc_lines = lightmotif.__doc__.splitlines()
if "See Also:" in doc_lines:
see_also = doc_lines.index("See Also:")
lightmotif.__doc__ = "\n".join(doc_lines[:see_also])
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx.ext.extlinks",
"sphinx_design",
"nbsphinx",
"recommonmark",
"IPython.sphinxext.ipython_console_highlighting",
]
templates_path = ['_templates']
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'**.ipynb_checkpoints',
'requirements.txt'
]
pygments_style = "monokailight"
default_role = "py:obj"
html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static/js', '_static/bibtex', '_static/css', '_static/json']
html_js_files = ["custom-icon.js"]
html_css_files = ["custom.css"]
html_theme_options = {
"external_links": [],
"show_toc_level": 2,
"use_edit_page_button": True,
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/althonos/lightmotif",
"icon": "fa-brands fa-github",
},
{
"name": "PyPI",
"url": "https://pypi.org/project/lightmotif",
"icon": "fa-custom fa-pypi",
},
],
"logo": {
"text": "LightMotif",
"image_light": "_images/logo-light.png",
"image_dark": "_images/logo-dark.png",
},
"navbar_start": ["navbar-logo", "version-switcher"],
"navbar_align": "left",
"footer_start": ["copyright"],
"footer_center": ["sphinx-version"],
"switcher": {
"json_url": "https://lightmotif.readthedocs.io/en/latest/_static/switcher.json",
"version_match": version,
}
}
html_context = {
"github_user": "althonos",
"github_repo": "lightmotif",
"github_version": "main",
"doc_path": "docs",
}
html_favicon = '_images/favicon.ico'
htmlhelp_basename = lightmotif.__name__
extlinks = {
'doi': ('https://doi.org/%s', 'doi:%s'),
'pmid': ('https://pubmed.ncbi.nlm.nih.gov/%s', 'PMID:%s'),
'pmc': ('https://www.ncbi.nlm.nih.gov/pmc/articles/PMC%s', 'PMC%s'),
'isbn': ('https://www.worldcat.org/isbn/%s', 'ISBN:%s'),
'wiki': ('https://en.wikipedia.org/wiki/%s', '%s'),
}
imgmath_image_format = "svg"
napoleon_include_init_with_doc = True
napoleon_include_special_with_doc = True
napoleon_include_private_with_doc = True
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
napoleon_use_rtype = False
autoclass_content = "class"
autodoc_member_order = 'groupwise'
autosummary_generate = []
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"psutil": ("https://psutil.readthedocs.io/en/latest/", None),
"numpy": ("https://numpy.org/doc/stable/", None)
}
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
}
nbsphinx_execute = 'auto'
nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
"--InlineBackend.rc={'figure.dpi': 96}",
]