Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autosummary document imported functions #1061

Closed
shimizukawa opened this issue Jan 3, 2015 · 15 comments
Closed

autosummary document imported functions #1061

shimizukawa opened this issue Jan 3, 2015 · 15 comments
Assignees
Labels
extensions:autodoc type:enhancement enhance or introduce a new feature
Milestone

Comments

@shimizukawa
Copy link
Member

Hello,

I'm looking for a way to exclude imported modules and functions.

The attached examples list isfile in functions of my module.


@shimizukawa shimizukawa added this to the 1.3 milestone Jan 3, 2015
@shimizukawa shimizukawa added type:enhancement enhance or introduce a new feature extensions:autodoc prio:low labels Jan 3, 2015
@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2013-01-20 02:12:50+00:00

I can not reproduce autodocing for imported modules and functions.

Please let me know about your 'autodoc' relative directive using in rst file.

@shimizukawa
Copy link
Member Author

From Tiago Coutinho on 2013-10-10 09:15:55+00:00

Hello,
I am using sphinx 1.1.3 to document my python project. I can confirm the bug.

I was preparing a bug report when I saw this one. I post my original report with the hope that it can help solve the bug:

I am using autosummary with autosummary_generate = True in the conf.py

The autosummary is generating documentation for functions/classes which are imported from another module.
Example:

#!python

# --- module1.py ----
def foo():
    """foo documentation"""
    pass

# --- module2.py ---
from module1 import foo
def bar():
    """bar documentation"""
    foo()

and the following RST:

#!rst

.. doc.rst

Documentation
============

.. autosummary::
   :toctree:

   module2

will generate a RST like:

#!rst

module2
=======

.. automodule:: module2

   .. rubric:: Functions

   .. autosummary::

      foo
      bar

Please don't hesitate to ask for more info if needed.
Thanks,
Tiago

@shimizukawa
Copy link
Member Author

From samuele_c on 2014-03-05 00:02:35+00:00

I'm having the exact same issue in Debian stable and Debian testing. Calling

.. autosummary:: 
   :toctree: _autosummary

includes functions imported from other modules in the summary table

@shimizukawa
Copy link
Member Author

From mzjn on 2014-08-23 17:44:07+00:00

A patch has been suggested at Stack Overflow: http://stackoverflow.com/a/25460763

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-08-29 01:53:58+00:00

We need a :imported: True option for autosummary (I think False is better for default).

It's a new feature and a incompatible change.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-12-19 03:41:29+00:00

Issue #1654 was marked as a duplicate of this issue.

@shimizukawa
Copy link
Member Author

From Luc Saffre on 2014-12-19 04:10:55+00:00

Yes, they are the same issues.

@embray
Copy link
Contributor

embray commented Mar 19, 2015

Unfortunately the fix for this issue in 3313276 broke some things for us in Astropy, because now the call to documenter.check_module() is used indiscriminately, whereas we want to document imported objects (because we want to document objects in the top-level namespace they're imported to, and not in the submodules they are defined in, in many cases.

This should at least be optional. I like the suggestion @shimizukawa made of an :imported: True option.

@jschueller
Copy link
Contributor

from what I understood, this change was a backward-incompatible commit preventing imported modules to be included in the toctree.

@RNAer
Copy link

RNAer commented Feb 11, 2016

It seems this problem is still not fixed?

@shimizukawa
Copy link
Member Author

PR #1663 closes this issue. @birkenfeld please take a look if you have chance.

@shimizukawa shimizukawa reopened this Feb 12, 2016
@birkenfeld
Copy link
Member

It looks like 1.3.2 already restored the desired behavior.

@wholmgren
Copy link

Maybe I'm missing something but I believe that this is still an issue, at least for my configuration. I'm using sphinx 1.4.1 and autosummary_generate = True. Here are the links to my conf.py, top level autosummary, the template that includes additional autosummary calls, and a sample page with the unwanted imported documentation (the sind, cosd, and Location are all imported).

The change suggested by this SO answer worked for me.

Thanks in advance, and apologies if I am in fact missing something.

@tk0miya tk0miya reopened this Apr 16, 2016
@tk0miya
Copy link
Member

tk0miya commented Apr 16, 2016

Reopen to investigation

@shimizukawa
Copy link
Member Author

Fixed by #3235.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions:autodoc type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants