1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
# Configuration file for the Sphinx documentation builder.
#
# For the full list of configuration options, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
from term_image import __version__, utils
from term_image.image.common import ImageMeta
from term_image.image.iterm2 import ITerm2ImageMeta
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath("../../src"))
# -- Project information -----------------------------------------------------
project = "Term-Image"
copyright = "2022, Toluwaleke Ogundipe"
author = "Toluwaleke Ogundipe"
release = __version__
# -- General configuration ---------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
]
# -- Options for HTML output -------------------------------------------------
html_theme = "furo"
html_logo = "resources/logo.png"
html_favicon = "resources/logo.ico"
# -- Options for extensions ----------------------------------------------
# # -- sphinx-autodoc -----------------------------------------------------
autodoc_default_options = {
"members": True,
"show-inheritance": True,
"member-order": "bysource",
"autosummary": True,
"autosummary-nosignatures": True,
}
autodoc_typehints = "description"
autodoc_typehints_format = "fully-qualified"
autodoc_typehints_description_target = "documented"
autodoc_member_order = "bysource"
autodoc_inherit_docstrings = False
# # -- sphinx-intersphinx ----------------------------------------------
intersphinx_mapping = {
"python": ("/usr/share/doc/python3-doc/html", None),
"pillow": ("/usr/share/doc/python-pil-doc/html", None),
"requests": ("/usr/share/doc/python-requests-doc/html", None),
"urwid": ("/usr/share/doc/python-urwid-doc/html", None),
}
# # -- sphinx_toolbox-github ----------------------------------------------
github_username = "AnonymouX47"
github_repository = "term-image"
# # -- sphinx_toolbox-more_autosummary ----------------------------------------------
autodocsumm_member_order = "bysource"
# -- Event handlers -------------------------------------------------------------
def autodocssumm_grouper(app, what, name, obj, section, parent):
from enum import EnumMeta
from types import FunctionType
if isinstance(obj, EnumMeta):
return "Enumerations"
elif isinstance(obj, type) and issubclass(obj, Warning):
return "Warnings"
elif isinstance(parent, type):
obj = vars(parent)[name.rpartition(".")[2]]
if isinstance(obj, utils.ClassProperty):
return "Class Properties"
elif isinstance(obj, utils.ClassInstanceProperty):
return "Class/Instance Properties"
elif isinstance(obj, property):
return "Instance Properties"
elif isinstance(obj, FunctionType):
return "Instance Methods"
elif isinstance(obj, utils.ClassInstanceMethod):
return "Class/Instance Methods"
elif isinstance(obj, classmethod):
return "Class Methods"
elif isinstance(obj, staticmethod):
return "Static Methods"
def setup(app):
pass
# -- Extras -----------------------------------------------------------
# The properties defined by the metaclass' would be invoked instead of returning the
# property defined by the class
for meta in (ImageMeta, ITerm2ImageMeta):
for attr, value in tuple(vars(meta).items()):
if isinstance(value, utils.ClassPropertyBase):
delattr(meta, attr)
|