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 8545445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:47:33+00:00 2026-06-11T12:47:33+00:00

I have a python package Im about to migrate over to sphinx from epydoc.

  • 0

I have a python package Im about to migrate over to sphinx from epydoc. The package itself is documented with the sphinx automodule function. Now I would like to have a summary of all the classes in my module in a simple list/table in the beginning of my documented module, or even better(?) in the toc-tree.

My automodule part (in pymunk.rst) looks like

.. automodule:: pymunk
    :members:
    :undoc-members:
    :show-inheritance:
    :inherited-members:

then in pymunk.constraint.rst

.. automodule:: pymunk.constraint
    :members:
    :undoc-members:
    :show-inheritance:
    :inherited-members:

and so on. In each file I would like a list of all the classes so its easy to get an overview of whats available without scrolling through the whole documentation or the monstrous index. End result something like

pymunk
    pymunk.Space
    pymunk.Circle
    ...

My main target is to build to html.

Right now Im thinking about doing something clever with javascript to extract out and insert a list, but there must be a better way?

(The current state of the documentation: http://pymunk.readthedocs.org/en/latest/pymunk.html)

  • 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-11T12:47:35+00:00Added an answer on June 11, 2026 at 12:47 pm

    jQuery turned out to be the easy way to do this.

    I added this to the raw rst file where I wanted the index:

    .. container:: custom-index
    
        .. raw:: html
    
            <script type="text/javascript" src='_static/pymunk.js'></script> 
    

    This way a div is inserted into the html output so that the script can be put in all files where I wanted this index and have a header on top.

    Then in pymunk.js I extracted the class, function and data tags and put into the index.

    The downside with a javascript approach to this problem is that it would be hard to have a complete class index in the TOC sidebar as now it just picks the items to be included in the index from the current page. It is also a bit of work to create the index on each page load, maybe if its a big module it will feel slow in some browsers.

    Full js code below:

    $(function (){
    var createList = function(selector){
    
        var ul = $('<ul>');
        var selected = $(selector);
    
        if (selected.length === 0){
            return;
        }
    
        selected.clone().each(function (i,e){
    
            var p = $(e).children('.descclassname');
            var n = $(e).children('.descname');
            var l = $(e).children('.headerlink');
    
            var a = $('<a>');
            a.attr('href',l.attr('href')).attr('title', 'Link to this definition');
    
            a.append(p).append(n);
    
            var entry = $('<li>').append(a);
            ul.append(entry);
        });
        return ul;
    }
    
    
    var c = $('<div style="float:left; min-width: 300px;">');
    
    var ul0 = c.clone().append($('.submodule-index'))
    
    customIndex = $('.custom-index');
    customIndex.empty();
    customIndex.append(ul0);
    
    var x = [];
    x.push(['Classes','dl.class > dt']);
    x.push(['Functions','dl.function > dt']);
    x.push(['Variables','dl.data > dt']);
    
    x.forEach(function (e){
        var l = createList(e[1]);
        if (l) {        
            var ul = c.clone()
                .append('<p class="rubric">'+e[0]+'</p>')
                .append(l);
        }
        customIndex.append(ul);
    });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the python package in Cygwin on Windows 7. However, typing python -V
I have installed python 32 package to the C:\python32 I have also set the
Looking in my /usr/local/lib/python.../dist-package directory, I have .egg directories and .egg files. Why does
I have a small GTK python application that imports a package (Twisted) that may
I am building an application in Python and I have my whole package. While
I have an esoteric question involving Python metaclasses. I am creating a Python package
If I have a Python module implemented as a directory (i.e. package) that has
I'm newish to the python ecosystem, and have a question about module editing. I
I have questions about egg files in Python. I have much Python code organized
I have got a question about plotting package for c++. For last few years

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.