Skip to content

Commit

Permalink
added sphinx hook to import description of luigi parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Daniel Keicher authored and haddadanas committed Jan 12, 2024
1 parent 02791dc commit dc8aaac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions columnflow/tasks/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ class PlotVariablesBaseMultiShifts(
description="sets the title of the legend; when empty and only one process is present in "
"the plot, the process_inst label is used; empty default",
)
"""
"""

exclude_index = True

Expand Down
10 changes: 10 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@
"numpy": ("https://numpy.org/doc/stable/", None),
}

import luigi


def process_docstring(app, what, name, obj, options, lines):
if isinstance(obj, luigi.parameter.Parameter):
if obj.description:
lines.append(f"Description: {obj.description}")


def add_intersphinx_aliases_to_inv(app):
from sphinx.ext.intersphinx import InventoryAdapter
Expand All @@ -136,3 +144,5 @@ def setup(app):
app.add_css_file("styles_common.css")
if html_theme in ("sphinx_rtd_theme", "alabaster", "sphinx_book_theme"):
app.add_css_file("styles_{}.css".format(html_theme))

app.connect("autodoc-process-docstring", process_docstring)

0 comments on commit dc8aaac

Please sign in to comment.