Skip to content

astropy autodoc templates should document __call__ method #1817

Closed

Description

@rhewett

From the dev list:

Q: (@rhewett)

  1. Is it possible to modify the astropy autodoc templates to document the
    __call__ method? ... I've tried adding the :special-functions: directive to the
    class.rst template, with no success. It might be nice for Astropy to have
    this anyway, as there are a few functors, especially in modeling, that don't
    have their call signatures in the documentation.

A: (@eteq)

This is a very good point. I think the fact that
:special-functions: doesn't work is probably a bug of some sort...
But regardless, it does make sense to document __call__ whenever it
is present.

Activity

  1. ghost assigned on Nov 22, 2013
  2. eteq commented on Nov 22, 2013

    @eteq
    Member

    I'm milestoning it to v0.3.1 (and assigning it to myself), as it's mainly a documentation fix.

  3. cdeil commented on Feb 22, 2014

    @cdeil
    Member

    @embray @nden @astrofrog Does anyone know how to do this?

    At the moment the API docs for models and fitters are pretty bad, because the __call__ method is not included in the documentation.

    See e.g. the SLSQPFitter or the Beta1D or Parametric1DModel docs.

  4. astrofrog commented on Feb 24, 2014

    @astrofrog
    Member

    @cdeil - It might just be a case of adding __call__ to the list of private methods to include on lines 466 and 467 of astropy/sphinx/ext/automodsumm.py:

                    ns['methods'], ns['all_methods'] = \
                                     get_members_class(obj, 'method', ['__init__'])
    

    I don't have time to test this - maybe you could try?

  5. modified the milestones: v0.3.2, v0.3.1 on Feb 25, 2014
  6. cdeil commented on Feb 26, 2014

    @cdeil
    Member

    @astrofrog I tried your suggestion and it does add __call__ to the API docs (see here for all classes that have this and how __call__ appears in their docs).

    So do we want this for all classes as part of the HTML docs?
    I'd be 👍 and can make a PR if we do ... the change is at https://github.com/cdeil/astropy/compare/issue_1817

  7. added a commit that references this issue on Feb 26, 2014
    dc498c0
  8. astrofrog commented on Feb 26, 2014

    @astrofrog
    Member

    @cdeil - that probably makes sense. Do you see any classes where this is being done but does not make sense?

  9. cdeil commented on Feb 26, 2014

    @cdeil
    Member

    I see some __call__ methods without a docstring (i.e. the user has no indication of what they do and what their inputs / outputs are), but I think all of those __call__ methods should be documented for users.

    Except maybe SAMPMsgReplierWrapper.call ... there I have no idea what it does.

  10. astrofrog commented on Feb 26, 2014

    @astrofrog
    Member

    @cdeil - I haven't figured out what that class does. I'll follow up with Luigi.

  11. cdeil commented on Feb 26, 2014

    @cdeil
    Member

    PR: #2135

  12. added 2 commits that reference this issue on Feb 26, 2014
    d893d79
    bc6b9fe
  13. cdeil commented on Mar 3, 2014

    @cdeil
    Member
  14. eteq commented on Mar 3, 2014

    @eteq
    Member

    @cdeil - I just tried to do this now, but nothing happened... and I also can't get it to manually build. It may be that there's some sort of trouble on the RTD side? Will try again in a bit.

  15. eteq commented on Mar 4, 2014

    @eteq
    Member

    Looks like RTD finally managed to pull itself together. If you look at http://astropy.readthedocs.org/en/latest/api/astropy.modeling.Model.html you'll see it now features a __call__ method. Thanks for pointing this out, @cdeil.

  16. added a commit that references this issue on Oct 28, 2014
    906c3a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions