Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow also non-functions/classes to be included in module API summary. #24

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

Merged
merged 2 commits into from
May 24, 2017

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented May 24, 2017

This is a rebase with renamed arguments of astropy/astropy-helpers#198, since the automodapi routines now seem to live here.

@astrofrog
Copy link
Member

astrofrog commented May 24, 2017

@mhvk - can you rebase? I now added the -v flag by default to pytest on Travis and AppVeyor to see full diffs by default. In addition it would be good to add a unit test for this. Finally, please add a changelog entry :)

@astrofrog astrofrog added this to the v0.4 milestone May 24, 2017
@mhvk mhvk force-pushed the include-all-objects branch from cd67090 to 05de710 Compare May 24, 2017 12:55
@mhvk
Copy link
Contributor Author

mhvk commented May 24, 2017

@astrofrog - That was useful -- now I saw the actual tests and understood how to test locally, I could make things to pass again. Will now see if I can add a useful new test.

@mhvk
Copy link
Contributor Author

mhvk commented May 24, 2017

@astrofrog - I think this is now ready, including a release note and tests. One suggestion from the previous discussion that I did not implement was to make any selection. So right now, if __all__ is defined, only those variables present will be documented; if not, all variables are. I'm not sure how to do better than this: if some module does from variables import *, and does not itself define an __all__, surely the variables should still be documented.

My own feeling is that, since it is opt-in to generate the list for global variables as well, it is OK to expect people that want to use it to spend the time to define __all__ and get this right.


* ``:global-variables-only:``
If present, the autosummary table will only contain entries for
functions. This cannot be used at the same time with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently doesn't make sense - do you mean variables instead of functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good old copy & paste. Corrected.

@mhvk mhvk force-pushed the include-all-objects branch from efdc9d1 to cff0e38 Compare May 24, 2017 15:35
``:classes-only:`` .
``:classes-only:`` or ``:global-variables-only:``.

* ``:global-variables-only:``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhvk - just out of curiosity, why 'global-variables-only' rather than simply 'variables-only'? Using 'global' is confusing since it's not actually going to include everything in globals()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I just followed the suggestion in the previous PR without thinking too much. I think you're right -- might as well call it variables only. I'll wait a bit in case you have other comments; then will make that change globally and squash the commits together.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhvk - no other comments for me, looks good otherwise :)

This is controlled by a new :include-all-objects: directive, which
in turn uses a new :variables-only: directive for the summaries.
@mhvk mhvk force-pushed the include-all-objects branch from cff0e38 to 07b8f32 Compare May 24, 2017 17:10
@astrofrog
Copy link
Member

Thanks!

@astrofrog astrofrog merged commit 6096c74 into astropy:master May 24, 2017
@mhvk mhvk deleted the include-all-objects branch May 24, 2017 21:13
astrofrog added a commit that referenced this pull request Jan 27, 2018
Allow also non-functions/classes to be included in module API summary.
astrofrog added a commit that referenced this pull request Jan 27, 2018
Allow also non-functions/classes to be included in module API summary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants