Skip to content

Commit

Permalink
docs: Link to source code
Browse files Browse the repository at this point in the history
Closes #149
  • Loading branch information
edgarrmondragon committed Feb 13, 2024
1 parent 2de41df commit e75a8f5
Showing 1 changed file with 43 additions and 9 deletions.
52 changes: 43 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from __future__ import annotations

import sys
from pathlib import Path
Expand All @@ -29,7 +30,7 @@
release = "0.35.0"


# -- General configuration ---------------------------------------------------
# -- General configuration -------------------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -40,6 +41,7 @@
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.linkcode",
"sphinx_copybutton",
"myst_parser",
"sphinx_reredirects",
Expand All @@ -55,12 +57,7 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# Show typehints in the description, along with parameter descriptions
autodoc_typehints = "description"
autodoc_class_signature = "separated"
autodoc_member_order = "groupwise"

# -- Options for HTML output -------------------------------------------------
# -- Options for HTML output -----------------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
Expand Down Expand Up @@ -118,7 +115,19 @@
"css/custom.css",
]

# -- Options for MyST --------------------------------------------------------
# -- Options for AutoDoc ---------------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration

# Show typehints in the description
autodoc_typehints = "description"

# Display the signature as a method.
autodoc_class_signature = "separated"

# Sort members by type.
autodoc_member_order = "groupwise"

# -- Options for MyST ------------------------------------------------------------------
# https://myst-parser.readthedocs.io/en/latest/configuration.html
myst_heading_anchors = 3
myst_enable_extensions = {
Expand All @@ -129,9 +138,34 @@
"porting.html": "guides/porting.html",
}

# -- Options for intersphinx -------------------------------------------------
# -- Options for intersphinx -----------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
intersphinx_mapping = {
"requests": ("https://requests.readthedocs.io/en/latest/", None),
"python": ("https://docs.python.org/3/", None),
}

# -- Options for linkcode --------------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#configuration


def linkcode_resolve(domain: str, info: dict) -> str | None:
"""Get URL to source code.
Args:
domain: Language domain the object is in.
info: A dictionary with domain-specific keys.
Returns:
A URL.
"""
if domain != "py":
return None
if not info["module"]:
return None
filename = info["module"].replace(".", "/")

if filename == "singer_sdk":
filename = "singer_sdk/__init__"

return f"https://github.com/meltano/sdk/tree/main/{filename}.py"

0 comments on commit e75a8f5

Please sign in to comment.