Skip to content

maint: Update conf.py #937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dist/
_autosummary
_build/
_gallery_backreferences
doc/source/api

# Testing
.coverage
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/937.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
maint: Update conf.py
48 changes: 46 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
"icon": "fa fa-comment fa-fw",
},
],
"ansys_sphinx_theme_autoapi": {
"project": project,
"keep_files": True,
"add_toctree_entry": True,
"package_depth": 5,
},
"cheatsheet": {
"file": "cheatsheet/cheat_sheet.qmd",
"title": "PyPrimeMesh cheat sheet",
Expand All @@ -67,7 +73,6 @@

# Sphinx extensions
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
"numpydoc",
"sphinx.ext.intersphinx",
Expand All @@ -79,10 +84,10 @@
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx_autodoc_typehints",
"sphinxemoji.sphinxemoji",
"sphinx_design",
"pyvista.ext.viewer_directive",
"ansys_sphinx_theme.extension.autoapi",
]
nbsphinx_execute = "always"

Expand Down Expand Up @@ -179,3 +184,42 @@
}

supress_warnings = ["docutils"]


exclude_patterns = [
"examples/**/*.ipynb",
"examples/**/*.py",
"examples/**/*.md5",
"api/ansys/visualizer/index.rst",
]


BUILD_API = True
if not BUILD_API:
exclude_patterns.append("autoapi")

BUILD_EXAMPLES = True
if not BUILD_EXAMPLES:
exclude_patterns.append("examples/**")
exclude_patterns.append("examples.rst")

jinja_contexts = {
"main_toctree": {
"build_api": BUILD_API,
"build_examples": BUILD_EXAMPLES,
}
}


def prepare_jinja_env(jinja_env) -> None:
"""Customize the jinja env.

Notes
-----
See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment

"""
jinja_env.globals["project_name"] = project


autoapi_prepare_jinja_env = prepare_jinja_env
Loading