Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:37:46+00:00 2026-06-15T18:37:46+00:00

I am trying to document a Python project with Sphinx, but I’m having trouble

  • 0

I am trying to document a Python project with Sphinx, but I’m having trouble combining the autodoc extension with a namedtuple generated class.

In one document, gammatone.rst, I have:

:mod:`gammatone` -- gammatone filterbank toolkit
================================================

.. automodule:: gammatone
   :members:
.. automodule:: gammatone.coeffs
   :members:

In my gammatone/coeffs.py, I have:

from collections import namedtuple

ERBFilterCoeffs = namedtuple(
    'ERBFilterCoeffs', # Most parameters omitted
    [
        'A0',
        'gain',
    ])

The code generated by namedtuple includes very generic docstrings that Sphinx’s autodoc module picks up and includes. I’d rather document the class properly myself, without forgoing autodoc for the rest of the module.

I’ve tried putting something like this just before the class:

"""
.. class:: ERBFilterCoeffs(A0, gain)
:param A0: A0 coefficient
:param gain: Gain coefficient

Magic coefficients.
"""

…but it doesn’t show up in the generated docs. Putting it after the class results in it being nested underneath the generic class documentation, rather than replacing it.

How do I simply tell Sphinx (and the autodoc extension) to use my documentation for the ERBFilterCoeffs class instead of that generated by namedtuple?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:37:48+00:00Added an answer on June 15, 2026 at 6:37 pm

    How about after defining ERBFilterCoeffs with the namedtuple, try assigning that doc string to ERBFilterCoeffs.__doc__?

    EDIT: Ok, how about this then:

    class ERBFilterCoeffs(namedtuple('ERBFilterCoeffs','a b c')):
        """
        this is the doc string for ERBFilterCoeffs
        """
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Sphinx to document a Python project of mine, but
I'm trying to use Sphinx to document a 5,000+ line project in Python. It
I am trying to start documenting an small Python project with Sphinx. I created
I'm trying to generate documentation for my project with Sphinx, but the output documentation
I am trying to strip XML tags from a document using Python, a language
I'm trying to add a document to couchDB from python using curl via the
I'm trying to build a python library for interacting with our RESTful API, but
I'm trying to validate an XML document in Python using lxml. DTD validation will
I'm using python's lxml and I'm trying to read an xml document, modify and
I'm trying to create an xml document in python, however some of the strings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.