2021-12-15 03:03:01 -08:00
|
|
|
# Configuration file for the Sphinx documentation builder.
|
|
|
|
#
|
|
|
|
# This file only contains a selection of the most common options. For a full
|
|
|
|
# list see the documentation:
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
import datetime
|
2021-12-15 03:03:01 -08:00
|
|
|
import os
|
2023-05-04 00:58:06 -07:00
|
|
|
import pathlib
|
2021-12-15 03:03:01 -08:00
|
|
|
import sys
|
2023-05-04 00:58:06 -07:00
|
|
|
from typing import List
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
import toml
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
# The full version, including alpha/beta/rc tags
|
|
|
|
# Get the version from the pyproject file.
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
ROOT = pathlib.Path(__file__).parent.parent
|
|
|
|
PACKAGE_SRC = ROOT / "kittycad"
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
sys.path.append(os.path.abspath("../kittycad"))
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
# -- Project information -----------------------------------------------------
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
project = "kittycad"
|
|
|
|
author = "KittyCAD Team Members"
|
|
|
|
year = datetime.date.today().year
|
|
|
|
copyright = str(year) + ", " + author
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
with open(os.path.abspath("../pyproject.toml"), "r") as f:
|
2021-12-15 03:03:01 -08:00
|
|
|
parsed_toml = toml.load(f)
|
2023-05-04 00:58:06 -07:00
|
|
|
version = parsed_toml["tool"]["poetry"]["version"]
|
|
|
|
version = "v" + version
|
|
|
|
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2021-12-15 03:54:43 -08:00
|
|
|
release = version
|
2023-05-04 00:58:06 -07:00
|
|
|
language = "en"
|
|
|
|
default_role = "any"
|
2021-12-15 03:03:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
# -- General configuration ---------------------------------------------------
|
|
|
|
|
|
|
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
|
|
# ones.
|
|
|
|
extensions = [
|
2023-05-04 00:58:06 -07:00
|
|
|
"autoclasstoc",
|
|
|
|
"sphinx.ext.autodoc",
|
|
|
|
"sphinx.ext.autosectionlabel",
|
|
|
|
"sphinx.ext.autosummary",
|
|
|
|
"sphinx.ext.coverage",
|
|
|
|
"sphinx.ext.doctest",
|
|
|
|
"sphinx.ext.graphviz",
|
|
|
|
"sphinx.ext.imgconverter",
|
|
|
|
"sphinx.ext.intersphinx",
|
|
|
|
"sphinx.ext.linkcode",
|
|
|
|
"sphinx.ext.mathjax",
|
|
|
|
"sphinx.ext.napoleon",
|
|
|
|
"sphinx.ext.viewcode",
|
|
|
|
"sphinx_autodoc_typehints",
|
|
|
|
"sphinx_rtd_theme",
|
|
|
|
"sphinx_copybutton",
|
|
|
|
"sphinxext.opengraph",
|
2021-12-15 03:03:01 -08:00
|
|
|
]
|
|
|
|
|
2021-12-15 03:54:43 -08:00
|
|
|
numpydoc_show_class_members = False
|
|
|
|
|
2021-12-15 03:03:01 -08:00
|
|
|
# Add any paths that contain templates here, relative to this directory.
|
2023-05-04 00:58:06 -07:00
|
|
|
templates_path = ["_templates"]
|
2021-12-15 03:03:01 -08:00
|
|
|
|
|
|
|
# List of patterns, relative to source directory, that match files and
|
|
|
|
# directories to ignore when looking for source files.
|
|
|
|
# This pattern also affects html_static_path and html_extra_path.
|
2023-05-04 00:58:06 -07:00
|
|
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
2021-12-15 03:03:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
|
|
|
|
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
|
|
# a list of builtin themes.
|
|
|
|
#
|
2023-05-04 00:58:06 -07:00
|
|
|
html_theme = "sphinx_rtd_theme"
|
2021-12-15 03:54:43 -08:00
|
|
|
|
|
|
|
# Add any paths that contain custom themes here, relative to this directory.
|
2023-05-04 00:58:06 -07:00
|
|
|
html_theme_path: List[str] = []
|
2021-12-15 03:03:01 -08:00
|
|
|
|
|
|
|
# Add any paths that contain custom static files (such as style sheets) here,
|
|
|
|
# relative to this directory. They are copied after the builtin static files,
|
|
|
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
2023-05-04 00:58:06 -07:00
|
|
|
html_static_path: List[str] = []
|
2021-12-15 03:03:01 -08:00
|
|
|
|
2021-12-15 03:54:43 -08:00
|
|
|
# The name of the Pygments (syntax highlighting) style to use.
|
2023-05-04 00:58:06 -07:00
|
|
|
pygments_style = "trac"
|
|
|
|
|
|
|
|
# pygments_style = "lovelace"
|
|
|
|
# pygments_dark_style = "one-dark"
|
|
|
|
|
|
|
|
# -- autodoc --
|
|
|
|
|
|
|
|
autodoc_default_options = {
|
|
|
|
"members": True,
|
|
|
|
"special-members": True,
|
|
|
|
"private-members": True,
|
|
|
|
"inherited-members": True,
|
|
|
|
"undoc-members": True,
|
|
|
|
"exclude-members": "__weakref__",
|
|
|
|
}
|
|
|
|
|
|
|
|
autodoc_inherit_docstrings = True
|
|
|
|
|
|
|
|
# -- autosummary --
|
|
|
|
|
|
|
|
autosummary_generate = True
|
|
|
|
autoclass_content = "both"
|
|
|
|
html_show_sourcelink = False
|
|
|
|
set_type_checking_flag = True
|
|
|
|
|
|
|
|
# -- autosectionlabel --
|
|
|
|
|
|
|
|
autosectionlabel_prefix_document = True
|
|
|
|
|
|
|
|
# -- intersphinx --
|
2021-12-15 03:54:43 -08:00
|
|
|
|
2021-12-15 03:03:01 -08:00
|
|
|
intersphinx_mapping = {
|
2023-05-04 00:58:06 -07:00
|
|
|
"python": ("https://docs.python.org/3", None),
|
2021-12-15 03:03:01 -08:00
|
|
|
}
|
|
|
|
|
2023-07-31 12:50:30 -07:00
|
|
|
|
2021-12-15 03:03:01 -08:00
|
|
|
# This is a function linkcode_resolve(domain, info), which should return the URL
|
|
|
|
# to source code corresponding to the object in given domain with given information.
|
|
|
|
# FROM: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html
|
|
|
|
def linkcode_resolve(domain, info):
|
2023-05-04 00:58:06 -07:00
|
|
|
if domain != "py":
|
2021-12-15 03:03:01 -08:00
|
|
|
return None
|
2023-05-04 00:58:06 -07:00
|
|
|
if not info["module"]:
|
2021-12-15 03:03:01 -08:00
|
|
|
return None
|
2023-05-04 00:58:06 -07:00
|
|
|
filename = info["module"].replace(".", "/")
|
2025-01-10 10:06:36 -05:00
|
|
|
return f"https://github.com/kittycad/kittycad.py/{filename}.py"
|
2021-12-15 03:03:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
# Spell checker.
|
|
|
|
try:
|
|
|
|
import enchant # noqa # pylint: disable=unused-import
|
|
|
|
except ImportError as ex:
|
2023-05-04 00:58:06 -07:00
|
|
|
print(
|
2025-01-10 10:06:36 -05:00
|
|
|
f"enchant module import failed:\n{ex}\nSpell checking disabled.",
|
2023-05-04 00:58:06 -07:00
|
|
|
file=sys.stderr,
|
|
|
|
)
|
2021-12-15 03:03:01 -08:00
|
|
|
else:
|
2023-05-04 00:58:06 -07:00
|
|
|
extensions.append("sphinxcontrib.spelling")
|
2021-12-15 03:03:01 -08:00
|
|
|
spelling_show_suggestions = True
|