Skip to content

Commit

Permalink
Update conf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
menckend authored Oct 25, 2024
1 parent 11e6fe1 commit d1900b5
Showing 1 changed file with 41 additions and 37 deletions.
78 changes: 41 additions & 37 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
import os
import sys

sys.path.insert(0, os.path.abspath('../external_sources/django/'))
sys.path.insert(0, os.path.abspath('../external_sources/dcnodatg/'))
sys.path.insert(0, os.path.abspath('../images/'))
sys.path.insert(0, os.path.abspath('../external_sources/netbox/'))
sys.path.insert(0, os.path.abspath('../netbox_ptov/'))

#sys.path.insert(0, os.path.abspath('./external_sources/django/'))
#sys.path.insert(0, os.path.abspath('./external_sources/dcnodatg/'))
#sys.path.insert(0, os.path.abspath('../images/'))
#sys.path.insert(0, os.path.abspath('./external_sources/netbox/'))
#sys.path.insert(0, os.path.abspath('../netbox_ptov/'))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

Expand All @@ -20,30 +23,35 @@
author = 'Mencken Davidson'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
source_suffix = [".rst", ".md"]
templates_path = ['_templates']
exclude_patterns = ['_build', '_templates', 'Thumbs.db', '.DS_Store']
html_show_sourcelink = False # Remove 'view source code' from top of page (for html, not python)
html_theme = 'sphinx_rtd_theme'
html_css_files = [
"css/custom.css",
]
html_static_path = ['_static']

# -- Extensions to use ---------------------------------------------------
extensions = [
'autoapi.extension',
'sphinx.ext.napoleon',
'myst_parser',
'sphinx.ext.autodoc', # Core Sphinx library for auto html doc generation from docstrings
'sphinx.ext.autosummary', # Create neat summary tables for modules/classes/methods etc
'sphinx.ext.intersphinx', # Link to other project's documentation (see mapping below)
'sphinx.ext.viewcode', # Add a link to the Python source code for classes, functions etc.
'sphinx_autodoc_typehints', # Automatically document param types (less noise in class signature)
'autoapi.extension',
]

source_suffix = [".rst", ".md"]
templates_path = ['_templates']
exclude_patterns = ['_build', '_templates', 'Thumbs.db', '.DS_Store']
html_show_sourcelink = True # Remove 'view source code' from top of page (for html, not python)
html_theme = 'sphinx_rtd_theme'
autodoc_typehints = "signature"
# -- Autoapi extension configuraiton ---------------------------------------------------
autodoc_typehints = "description"
autoapi_template_dir = "_templates/autoapi"
#autodoc_class_signature = "separated"
autoapi_own_page_level = "function"
autoapi_dirs = ['../netbox_ptov/', './external_sources/netbox/', './external_sources/netbox/' ]
autoapi_dirs = ['../netbox_ptov/']
autoapi_type = "python"
autoapi_prepare_jinja_env = prepare_jinja_env
autoapi_options = [
"members",
"undoc-members",
Expand All @@ -52,22 +60,17 @@
"imported-members",
]

html_css_files = [
"css/custom.css",
]

#on_rtd = os.environ.get("READTHEDOCS", None) == "True"
#if not on_rtd: # only import and set the theme if we're building docs locally
# import sphinx_rtd_theme
# html_theme = "sphinx_rtd_theme"
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
#html_css_files = ["readthedocs-custom.css"] # Override some CSS settings

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_static_path = ['_static']
#--RTD theme configuration ----------------------------------------------------------------------------
html_theme_options = {
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': -1,
'includehidden': True,
'titles_only': False
}

#--Napoleon extnesion ocnfiguration ------------------------------------------------------
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = True
Expand All @@ -83,20 +86,21 @@
napoleon_type_aliases = None
napoleon_attr_annotations = True

#--Functions ----------------------------------------------------------------------------
def contains(seq, item):
return item in seq

def prepare_jinja_env(jinja_env) -> None:
jinja_env.tests["contains"] = contains

autoapi_prepare_jinja_env = prepare_jinja_env
def linkcode_resolve(domain, info):
if domain != 'py':
return None
if not info['module']:
return None
filename = info['module'].replace('.', '/')
return "https://github.com/netbox-community/netbox/%s.py" % filename




html_theme_options = {
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': -1,
'includehidden': True,
'titles_only': False
}

0 comments on commit d1900b5

Please sign in to comment.