tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

conf.py (3855B)


      1 from importlib import metadata
      2 from typing import TYPE_CHECKING
      3 
      4 
      5 if TYPE_CHECKING:
      6    import sphinx.application
      7 
      8 
      9 extensions = [
     10    "sphinx.ext.autodoc",
     11    "sphinx.ext.doctest",
     12    "sphinx.ext.intersphinx",
     13    "sphinx.ext.coverage",
     14    "sphinx.ext.viewcode",
     15 ]
     16 
     17 # Add any paths that contain templates here, relative to this directory.
     18 templates_path = ["_templates"]
     19 
     20 source_suffix = ".rst"
     21 
     22 # The master toctree document.
     23 master_doc = "index"
     24 
     25 # General information about the project.
     26 
     27 project = "pluggy"
     28 copyright = "2016, Holger Krekel"
     29 author = "Holger Krekel"
     30 
     31 release = metadata.version(project)
     32 # The short X.Y version.
     33 version = ".".join(release.split(".")[:2])
     34 
     35 
     36 language = "en"
     37 
     38 pygments_style = "sphinx"
     39 # html_logo = "_static/img/plug.png"
     40 html_theme = "alabaster"
     41 html_theme_options = {
     42    "logo": "img/plug.png",
     43    "description": "The pytest plugin system",
     44    "github_user": "pytest-dev",
     45    "github_repo": "pluggy",
     46    "github_button": "true",
     47    "github_banner": "true",
     48    "github_type": "star",
     49    "badge_branch": "main",
     50    "page_width": "1080px",
     51    "sidebar_width": "300px",
     52    "fixed_sidebar": "false",
     53 }
     54 html_sidebars = {
     55    "**": ["about.html", "localtoc.html", "relations.html", "searchbox.html"]
     56 }
     57 html_static_path = ["_static"]
     58 
     59 # One entry per manual page. List of tuples
     60 # (source start file, name, description, authors, manual section).
     61 man_pages = [(master_doc, "pluggy", "pluggy Documentation", [author], 1)]
     62 
     63 autodoc_member_order = "bysource"
     64 
     65 nitpicky = True
     66 nitpick_ignore = {
     67    # Don't want to expose this yet (see #428).
     68    ("py:class", "pluggy._tracing.TagTracerSub"),
     69    # Compat hack, don't want to expose it.
     70    ("py:class", "pluggy._manager.DistFacade"),
     71    # `types.ModuleType` turns into `module` but then fails to resolve...
     72    ("py:class", "module"),
     73    # Just a TypeVar.
     74    ("py:obj", "pluggy._result.ResultType"),
     75    ("py:class", "pluggy._result.ResultType"),
     76 }
     77 
     78 # -- Options for Texinfo output -------------------------------------------
     79 
     80 # Grouping the document tree into Texinfo files. List of tuples
     81 # (source start file, target name, title, author,
     82 #  dir menu entry, description, category)
     83 texinfo_documents = [
     84    (
     85        master_doc,
     86        "pluggy",
     87        "pluggy Documentation",
     88        author,
     89        "pluggy",
     90        "One line description of project.",
     91        "Miscellaneous",
     92    )
     93 ]
     94 
     95 # Example configuration for intersphinx: refer to the Python standard library.
     96 intersphinx_mapping = {
     97    "python": ("https://docs.python.org/3", None),
     98    "pytest": ("https://docs.pytest.org/en/latest", None),
     99    "setuptools": ("https://setuptools.pypa.io/en/latest", None),
    100    "tox": ("https://tox.wiki/en/latest", None),
    101    "devpi": ("https://devpi.net/docs/devpi/devpi/stable/+doc/", None),
    102    "kedro": ("https://docs.kedro.org/en/latest/", None),
    103 }
    104 
    105 
    106 def configure_logging(app: "sphinx.application.Sphinx") -> None:
    107    """Configure Sphinx's WarningHandler to handle (expected) missing include."""
    108    import logging
    109 
    110    import sphinx.util.logging
    111 
    112    class WarnLogFilter(logging.Filter):
    113        def filter(self, record: logging.LogRecord) -> bool:
    114            """Ignore warnings about missing include with "only" directive.
    115 
    116            Ref: https://github.com/sphinx-doc/sphinx/issues/2150."""
    117            if (
    118                record.msg.startswith('Problems with "include" directive path:')
    119                and "_changelog_towncrier_draft.rst" in record.msg
    120            ):
    121                return False
    122            return True
    123 
    124    logger = logging.getLogger(sphinx.util.logging.NAMESPACE)
    125    warn_handler = [x for x in logger.handlers if x.level == logging.WARNING]
    126    assert len(warn_handler) == 1, warn_handler
    127    warn_handler[0].filters.insert(0, WarnLogFilter())
    128 
    129 
    130 def setup(app: "sphinx.application.Sphinx") -> None:
    131    configure_logging(app)