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

some api documentation generation improvements #1318

Closed
RobinD42 opened this issue Aug 14, 2020 · 2 comments · Fixed by #1348
Closed

some api documentation generation improvements #1318

RobinD42 opened this issue Aug 14, 2020 · 2 comments · Fixed by #1348
Assignees

Comments

@RobinD42
Copy link
Contributor

RobinD42 commented Aug 14, 2020

From Ardavan:

I noticed a few minor improvements we can make to the generate_py_api.py
which required me to manually edit Python_User_Interface.md:

  • in the entry for "EigenModeSource" and "GaussianBeamSource" in
    meep/python/source.py, the line "component=mp.ALL_COMPONENTS" is being
    replaced with "component=20" (it would be good to preserve the original
    "mp.ALL_COMPONENTS"). Same for "direction=mp.AUTOMATIC" and
    "eig_kpoint=mp.Vector3()"

  • in the init code block of the PML object, the line
    "pml_profile=lambda u: u * u)" in meep/python/simulation.py is showing
    up as "pml_profile=<function PML. at 0x7f4f93f958c8>)" (it would
    be good to preserve the text showing the inline function definition)

  • in some cases (i.e., "add_mode_monitor(self, *args, **kwargs):"),
    an unnecessary blank space is inserted after the colon

  • the line "See help(type(self)) for accurate signature." was
    changed to "See help(type(self)) for accurate signature." (i.e.,
    backticks were necessary to place the text inside a code block but I
    couldn't find where this line actually appears in either
    meep/python/*.py, Python_User_Interface.md.in, or generate_py_api.py)

@RobinD42 RobinD42 self-assigned this Aug 14, 2020
@RobinD42
Copy link
Contributor Author

Also:

Do we need to document the new Verbosity class that you added in #1302 ("Add verbosity flag for MPB")? Should the "verbosity" parameter documented in https://meep.readthedocs.io/en/latest/Python_User_Interface/#miscellaneous-functions-reference be updated/replaced?

@RobinD42
Copy link
Contributor Author

RobinD42 commented Sep 1, 2020

@oskooi,

the line "See help(type(self)) for accurate signature." ... but I couldn't find where this line actually appears...

That text comes from the docstring for object.__init__. When a class has an __init__ without a docstring then the introspection module will look for a docstring up the inheritance hierarchy that it can use instead. So the best way to deal with this is to ensure that the __init__ for all documented classes have a docstring.

In [1]: object.__init__.__doc__
Out[1]: 'Initialize self.  See help(type(self)) for accurate signature.'

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 a pull request may close this issue.

1 participant