# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2023-present Hydrogram
#
# This file is part of Hydrogram.
#
# Hydrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Hydrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Hydrogram. If not, see .
import datetime
import sys
from pathlib import Path
# Setup path for imports
docs_dir = Path(__file__).parent.parent
sys.path.insert(0, docs_dir.resolve().as_posix())
import hydrogram # noqa: E402
# Project information
project = "Hydrogram"
author = "Hydrogram"
copyright = f"{datetime.date.today().year}, {author}"
release = hydrogram.__version__
# Sphinx extensions
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinxcontrib.towncrier.ext",
]
# Intersphinx mapping for external documentation
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"aiosqlite": ("https://aiosqlite.omnilib.dev/en/stable/", None),
}
# Basic configuration
master_doc = "index"
source_suffix = ".rst"
pygments_style = "friendly"
# Documentation generation settings
autodoc_member_order = "bysource"
autodoc_typehints = "none"
html_use_modindex = False
html_use_index = False
# Napoleon settings (for Google-style docstrings)
napoleon_use_rtype = False
napoleon_use_param = False
# Towncrier settings
towncrier_draft_autoversion_mode = "draft"
towncrier_draft_include_empty = True
towncrier_draft_working_directory = Path(__file__).parent.parent.parent
# HTML theme settings
html_theme = "furo"
html_title = f"{project} v{release} Documentation"
html_last_updated_fmt = (
f"{datetime.datetime.now(tz=datetime.UTC).strftime('%d/%m/%Y, %H:%M:%S')} UTC"
)
html_copy_source = False
html_static_path = ["_static"]
html_css_files = [
"css/all.min.css",
"css/custom.css",
]
# Icons for footer (from https://react-icons.github.io/react-icons)
TELEGRAM_ICON = (
''
''
)
GITHUB_ICON = (
''
""
)
WEBSITE_ICON = (
''
''
)
# Theme options configuration
html_theme_options = {
"navigation_with_keys": True,
# CSS variables
"dark_css_variables": {
"admonition-title-font-size": "0.95rem",
"admonition-font-size": "0.92rem",
},
"light_css_variables": {
"admonition-title-font-size": "0.95rem",
"admonition-font-size": "0.92rem",
},
# Logo configuration
"light_logo": "hydrogram-light.png",
"dark_logo": "hydrogram-dark.png",
# Footer icons
"footer_icons": [
{
"name": "Telegram Channel",
"url": "https://t.me/HydrogramNews/",
"html": TELEGRAM_ICON,
"class": "",
},
{
"name": "GitHub Organization",
"url": "https://github.com/hydrogram/",
"html": GITHUB_ICON,
"class": "",
},
{
"name": "Hydrogram Website",
"url": "https://hydrogram.org/",
"html": WEBSITE_ICON,
"class": "",
},
],
}