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

Use help parameter for traits rather than setting __doc__ #2844

Open
dopplershift opened this issue Dec 19, 2022 · 2 comments
Open

Use help parameter for traits rather than setting __doc__ #2844

dopplershift opened this issue Dec 19, 2022 · 2 comments
Labels
Area: Docs Affects documentation good first issue Straightforward issues suitable for new and inexperienced contributors to the project Type: Maintenance Updates and clean ups (but not wrong)

Comments

@dopplershift
Copy link
Member

Currently all the traits in the simplified plotting interface are documented by setting the __doc__ attribute. Traits have a help parameter in the constructor that we can use instead, and with traitlets 5.8.0, this now maps to the __doc__ attribute.

We should update, though we should check on whether there are other impacts of this beyond just building our docs (e.g. in jupyter environments). If there are jupyter ramifications, we probably want to wait a bit before making 5.8.0 our minimum version.

@dopplershift dopplershift added Type: Maintenance Updates and clean ups (but not wrong) Area: Docs Affects documentation good first issue Straightforward issues suitable for new and inexperienced contributors to the project labels Dec 19, 2022
@mohamed591195
Copy link

Hello! I'm interested in contributing to this project, Could you provide some guidance on how to approach this issue, or suggest any resources that could help me get started

@dcamron
Copy link
Member

dcamron commented Aug 2, 2023

Hi @mohamed591195! Thanks for your interest. Definitely start with the MetPy Contributor's Guide to get set up first. This issue concerns declarative.py and the variety of class parameters we define using the traitlets library. declarative.ArrowPlot.arrowscale is one such Trait, and there are many in the file. You can see how these traits are used in this tutorial on the docs.

All of these traits have docstrings we manually assign to traitlet.__doc__ so that users know the specific behavior of each trait. If we can update this to use the help parameter when we construct our traitlets (see eg this function signature and all others on that page), we might get more compatibility with other tools in the space, and make the docstrings more discoverable and usable by MetPy users.

Some considerations:

  • this is only doable with traitlets>=5.8.0, so you'll have to see if enforcing that minimum version in pyproject.toml breaks anything
  • changing this parameter might have ramifications on the MetPy documentation, be sure to take a look to see if/how things change
  • we rely on some of these docstrings for usability in Jupyter, eg help(), ?, and <Tab> completion. Be sure to explore these and see how behaviors change before and after your change

I hope this is plenty to help you get started, and we look forward to a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Docs Affects documentation good first issue Straightforward issues suitable for new and inexperienced contributors to the project Type: Maintenance Updates and clean ups (but not wrong)
Projects
None yet
Development

No branches or pull requests

3 participants