2025-01-15 21:45:29 +00:00
|
|
|
# Configuration file for the Sphinx documentation builder.
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
2025-02-10 22:51:04 +00:00
|
|
|
import sys
|
|
|
|
import os
|
2025-01-15 21:45:29 +00:00
|
|
|
from importlib.metadata import metadata
|
2025-02-21 16:52:30 +00:00
|
|
|
from datetime import datetime
|
2025-01-15 21:45:29 +00:00
|
|
|
|
2025-02-11 18:37:03 +00:00
|
|
|
sys.path.append(os.path.abspath('../scripts'))
|
2025-02-10 22:51:04 +00:00
|
|
|
from scripts import generate_module_docs
|
2025-02-21 16:52:30 +00:00
|
|
|
from auto_archiver.version import __version__
|
2025-02-10 22:51:04 +00:00
|
|
|
|
|
|
|
# -- Project Hooks -----------------------------------------------------------
|
|
|
|
# convert the module __manifest__.py files into markdown files
|
|
|
|
generate_module_docs()
|
|
|
|
|
|
|
|
|
|
|
|
# -- Project information -----------------------------------------------------
|
2025-01-15 21:45:29 +00:00
|
|
|
package_metadata = metadata("auto-archiver")
|
|
|
|
project = package_metadata["name"]
|
2025-02-21 16:52:30 +00:00
|
|
|
copyright = str(datetime.now().year)
|
|
|
|
author = "Bellingcat"
|
2025-01-15 21:45:29 +00:00
|
|
|
release = package_metadata["version"]
|
2025-02-10 22:51:04 +00:00
|
|
|
language = 'en'
|
2025-01-15 21:45:29 +00:00
|
|
|
|
|
|
|
# -- General configuration ---------------------------------------------------
|
|
|
|
extensions = [
|
2025-02-11 13:49:30 +00:00
|
|
|
"myst_parser", # Markdown support
|
2025-01-15 21:45:29 +00:00
|
|
|
"autoapi.extension", # Generate API documentation from docstrings
|
2025-02-10 22:51:04 +00:00
|
|
|
"sphinxcontrib.mermaid", # Mermaid diagrams
|
2025-01-15 21:45:29 +00:00
|
|
|
"sphinx.ext.viewcode", # Source code links
|
2025-02-11 19:42:03 +00:00
|
|
|
"sphinx_copybutton",
|
2025-01-15 21:45:29 +00:00
|
|
|
"sphinx.ext.napoleon", # Google-style and NumPy-style docstrings
|
2025-02-10 16:24:16 +00:00
|
|
|
"sphinx.ext.autosectionlabel",
|
2025-01-15 21:45:29 +00:00
|
|
|
# 'sphinx.ext.autosummary', # Summarize module/class/function docs
|
|
|
|
]
|
|
|
|
|
|
|
|
templates_path = ['_templates']
|
2025-02-21 16:52:30 +00:00
|
|
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ""]
|
2025-01-15 21:45:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -- AutoAPI Configuration ---------------------------------------------------
|
|
|
|
autoapi_type = 'python'
|
2025-02-11 14:37:29 +00:00
|
|
|
autoapi_dirs = ["../../src/auto_archiver/core/", "../../src/auto_archiver/utils/"]
|
|
|
|
# get all the modules and add them to the autoapi_dirs
|
|
|
|
autoapi_dirs.extend([f"../../src/auto_archiver/modules/{m}" for m in os.listdir("../../src/auto_archiver/modules")])
|
2025-01-15 21:45:29 +00:00
|
|
|
autodoc_typehints = "signature" # Include type hints in the signature
|
2025-02-10 16:24:16 +00:00
|
|
|
autoapi_ignore = ["*/version.py", ] # Ignore specific modules
|
2025-02-11 14:37:29 +00:00
|
|
|
autoapi_keep_files = True # Option to retain intermediate JSON files for debugging
|
2025-01-15 21:45:29 +00:00
|
|
|
autoapi_add_toctree_entry = True # Include API docs in the TOC
|
2025-02-10 16:24:16 +00:00
|
|
|
autoapi_python_use_implicit_namespaces = True
|
|
|
|
autoapi_template_dir = "../_templates/autoapi"
|
2025-01-15 21:45:29 +00:00
|
|
|
autoapi_options = [
|
|
|
|
"members",
|
|
|
|
"undoc-members",
|
|
|
|
"show-inheritance",
|
|
|
|
"imported-members",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# -- Markdown Support --------------------------------------------------------
|
|
|
|
myst_enable_extensions = [
|
|
|
|
"deflist", # Definition lists
|
|
|
|
"html_admonition", # HTML-style admonitions
|
|
|
|
"html_image", # Inline HTML images
|
|
|
|
"replacements", # Substitutions like (C)
|
|
|
|
"smartquotes", # Smart quotes
|
|
|
|
"linkify", # Auto-detect links
|
|
|
|
"substitution", # Text substitutions
|
|
|
|
]
|
2025-02-10 16:24:16 +00:00
|
|
|
myst_heading_anchors = 2
|
2025-02-10 22:51:04 +00:00
|
|
|
myst_fence_as_directive = ["mermaid"]
|
2025-02-10 16:24:16 +00:00
|
|
|
|
2025-01-15 21:45:29 +00:00
|
|
|
source_suffix = {
|
|
|
|
".rst": "restructuredtext",
|
|
|
|
".md": "markdown",
|
|
|
|
}
|
|
|
|
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
2025-02-10 22:51:04 +00:00
|
|
|
html_theme = 'sphinx_book_theme'
|
2025-02-12 11:16:17 +00:00
|
|
|
html_static_path = ["../_static"]
|
|
|
|
html_css_files = ["custom.css"]
|
2025-02-21 16:52:30 +00:00
|
|
|
html_title = f"Auto Archiver v{__version__}"
|
|
|
|
html_logo = "bc.png"
|
|
|
|
html_theme_options = {
|
|
|
|
"repository_url": "https://github.com/bellingcat/auto-archiver",
|
|
|
|
"use_repository_button": True,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-01-15 21:45:29 +00:00
|
|
|
|
2025-02-18 19:10:09 +00:00
|
|
|
copybutton_prompt_text = r">>> |\.\.\."
|
|
|
|
copybutton_prompt_is_regexp = True
|
|
|
|
copybutton_only_copy_prompt_lines = False
|