-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b790dd
commit 9aadd30
Showing
1 changed file
with
98 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,109 @@ | ||
"""Sphinx configuration.""" | ||
import importlib.metadata | ||
import os | ||
import shutil | ||
### import setup ################################################################################## | ||
|
||
from sphinx.ext import apidoc | ||
import datetime | ||
|
||
# Run sphinx-apidoc | ||
# This hack is necessary since RTD does not issue `sphinx-apidoc` before running | ||
# `sphinx-build -b html . _build/html`. See Issue: | ||
# https://github.com/readthedocs/readthedocs.org/issues/1139 | ||
### project information ########################################################################### | ||
|
||
project = "Brightway Temporalis" | ||
author = "Brightway Developers" | ||
copyright = datetime.date.today().strftime("%Y") + ' Brightway Developers' | ||
|
||
__location__ = os.path.dirname(__file__) | ||
### project configuration ######################################################################### | ||
|
||
output_dir = os.path.join(__location__, "api") | ||
module_dir = os.path.join(__location__, "../bw_temporalis") | ||
try: | ||
shutil.rmtree(output_dir) | ||
except FileNotFoundError: | ||
pass | ||
extensions = [ | ||
# native extensions | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.mathjax', | ||
'sphinx.ext.viewcode', | ||
'sphinx.ext.intersphinx', | ||
'sphinx.ext.extlinks', | ||
'sphinx.ext.napoleon', | ||
# theme | ||
'sphinx_rtd_theme', | ||
# Markdown support | ||
'myst_parser', | ||
# API documentation support | ||
'autoapi', | ||
# responsive web component support | ||
'sphinx_design', | ||
# copy button on code blocks | ||
"sphinx_copybutton", | ||
] | ||
|
||
try: | ||
args = f"--implicit-namespaces -f -o {output_dir} {module_dir}".split(" ") | ||
apidoc.main(args) | ||
except Exception as e: | ||
print("Running `sphinx-apidoc` failed!\n{}".format(e)) | ||
exclude_patterns = ['_build'] | ||
|
||
# General Configuration | ||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
### theme configuration ############################################################################ | ||
|
||
html_theme = "sphinx_rtd_theme" | ||
html_title = "Brightway Temporalis" | ||
html_show_sphinx = False | ||
|
||
html_theme_options = { | ||
'logo_only': False, | ||
'display_version': True, | ||
'prev_next_buttons_location': 'bottom', | ||
# Toc options | ||
'collapse_navigation': True, | ||
'sticky_navigation': True, | ||
'navigation_depth': 4, | ||
'includehidden': True, | ||
'titles_only': True | ||
} | ||
|
||
html_logo = 'https://raw.githubusercontent.com/brightway-lca/brightway-documentation/main/source/_static/logo/BW_all_white_transparent_landscape_wide.svg' | ||
html_favicon = 'https://github.com/brightway-lca/brightway-documentation/blob/main/source/_static/logo/BW_favicon_500x500.png' | ||
|
||
### extension configuration ######################################################################## | ||
|
||
## myst_parser configuration ############################################ | ||
## https://myst-parser.readthedocs.io/en/latest/configuration.html | ||
|
||
project = "bw_temporalis" | ||
author = "Chris Mutel" | ||
copyright = "2023, Chris Mutel" | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.napoleon", | ||
"myst_parser", | ||
] | ||
source_suffix = { | ||
".rst": "restructuredtext", | ||
".md": "markdown", | ||
} | ||
autodoc_typehints = "description" | ||
html_theme = "furo" | ||
'.rst': 'restructuredtext', | ||
'.md': 'markdown', | ||
} | ||
|
||
myst_enable_extensions = [ | ||
"amsmath", | ||
"colon_fence", | ||
"deflist", | ||
"dollarmath", | ||
"html_image", | ||
] | ||
|
||
## autoapi configuration ################################################ | ||
## https://sphinx-autoapi.readthedocs.io/en/latest/reference/config.html#customisation-options | ||
|
||
needs_sphinx = "5.0" | ||
autoapi_options = [ | ||
'members', | ||
'undoc-members', | ||
'private-members', | ||
'show-inheritance', | ||
'show-module-summary', | ||
] | ||
|
||
autoapi_python_class_content = 'both' | ||
autoapi_member_order = 'groupwise' | ||
autoapi_root = 'content/api' | ||
autoapi_keep_files = False | ||
|
||
autoapi_dirs = [ | ||
'../bw_temporalis', | ||
] | ||
|
||
version = importlib.metadata.version("bw_temporalis") | ||
autoapi_ignore = [ | ||
'*/data/*', | ||
'*tests/*', | ||
'*tests.py', | ||
'*validation.py', | ||
'*version.py', | ||
'*.rst', | ||
'*.yml', | ||
'*.md', | ||
'*.json', | ||
'*.data' | ||
] |