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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:53:26+00:00 2026-05-27T15:53:26+00:00

Can sphinx’s .. automodule:: and other automatic features be used to document modules that

  • 0

Can sphinx’s .. automodule:: and other automatic features be used to document modules that include from x import * statements without including all of the documentation from imported modules?

EDIT:
As per mzjn’s point, as long as the imported methods’ __module__ attribute are not the same as the module name, they shouldn’t be documented. However, for some of my modules, they are.

my MLE is just a file test_doc.py file with the following line:

from pylab import *

and the documentation:

.. automodule:: agpy.test_doc
    :members:

If I include this line in test_doc.py:

print "beta.__module__:",beta.__module__

I get the expected result:

beta.__module__: None

Any idea what’s going on? Could I have screwed something up in conf.py?

EDIT: A workaround, as per mzjn’s answer, to change the __module__ attribute of those functions that have __module__==None:

import pylab
from pylab import *
for k,v in pylab.__dict__.iteritems():  
    if hasattr(v,'__module__'):
        if v.__module__ is None:
            locals()[k].__module__ = 'pylab'
  • 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-05-27T15:53:27+00:00Added an answer on May 27, 2026 at 3:53 pm

    Yes, that should work. From the documentation:

    In an automodule directive with the members option set, only module members whose __module__ attribute is equal to the module name as given to automodule will be documented. This is to prevent documentation of imported classes or functions.


    Update:

    The problem seems to be that the __module__ attribute of many pylab members is None (the members defined in the C/Cython module mtrand, as far as I can tell).

    The mtrand module is part of NumPy. Behind the scenes, pylab.beta (and several other functions) is a method of the class numpy.random.mtrand.RandomState. I can reproduce the documentation issue as follows:

    With this source (pylabtest.py)

    from pylab import beta
    
    def mzjn(x):
        """mzjn docstring"""
        return x
    

    and this source documentation (pylabtest.rst)

    Pylab test
    ==========
    
    .. automodule:: pylabtest
        :members:
    

    the Sphinx output in pylabtest.html includes both beta and mzjn.

    But if

    beta.__module__ = "pylab"
    

    is added to pylabtest.py, only mzjn is documented.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get all the records from the index using Sphinx? Just like
While writing documentation using Sphinx, I know that I can link to a class
I need to synthesize a voice so that it can be used to speak
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
Thinking sphinx documentation says that it automatically sorts the results based on relevance. What
Doing a search using django-sphinx gives me results._sphinx that says there were 68 results,
I know you can sort by integer values in sphinx but is there a
How can you fix the Sphinx's warning at the bottom? I am trying to
I need to create a simple search but I can't afford to use Sphinx.

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.