Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
fix: don't show namedtuple attrs in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LimaoC committed Aug 19, 2024
1 parent 0f5fb18 commit c4827e5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import collections
import os
import sys

Expand Down Expand Up @@ -42,3 +43,19 @@

html_theme = "piccolo_theme"
html_static_path = ["_static"]

# -- Post process ------------------------------------------------------------


def remove_namedtuple_attrib_docstring(app, what, name, obj, skip, options):
"""Removes the auto-generated docstring for NamedTuple attributes.
REF: https://stackoverflow.com/questions/61572220/python-sphinx-namedtuple-documentation
"""
if type(obj) is collections._tuplegetter:
return True
return skip


def setup(app):
app.connect("autodoc-skip-member", remove_namedtuple_attrib_docstring)

0 comments on commit c4827e5

Please sign in to comment.