8000 Auto-generate required kwdoc entries into docstring.interpd. by anntzer · Pull Request #20164 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Auto-generate required kwdoc entries into docstring.interpd. #20164

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, 2021

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented May 5, 2021

This does two things:

  • Replace Foo_kwdoc docstring substitutions by auto-generated
    Foo:kwdoc substitutions, removing the need to explicitly call
    docstring.interpd.update(Foo_kwdoc=artist.kwdoc(Foo)) for each
    artist.

  • Decorating a class with docstring.interpd will now also perform
    interpolation over the docstring of the class' __init__, making it
    possible to list properties here as well, instead of having to
    manually call docstring.interpd after the class has been defined.

The new behavior is also explained in documenting_mpl.rst. I think it's
slightly more magical, but also easier to explain...

Thoughts?

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak
Copy link
Member
jklymak commented May 5, 2021

Wow, I learn something new everyday - I had no idea docstring.py was our module, I just assumed it was some standard tool.

Since we are screwing with this, is it possible to come up with a better name that docstring.interpd, even it if it more verbose? interpd is pretty mysterious unless you go and read the definition (which is not searchable, so you have to know to go to docstring.py). inject_artist_kwargs or something would make more sense to me.

@anntzer
Copy link
Contributor Author
anntzer commented May 5, 2021

Seems fine to me, but I guess that can be a separate PR? It's just a global search-replace anyways... (the old name can be kept for backcompat)

@jklymak
Copy link
Member
jklymak commented May 5, 2021

I mean you are changing them all the instances here, is this not a good time to decide what to change them to?

@anntzer
Copy link
Contributor Author
anntzer commented May 5, 2021

I'm not changing the name of interpd? (perhaps I'm just confused?)

anntzer added 2 commits May 20, 2021 22:24
This does two things:

- Replace Foo_kwdoc docstring substitutions by auto-generated
  Foo:kwdoc substitutions, removing the need to explicitly call
  `docstring.interpd.update(Foo_kwdoc=artist.kwdoc(Foo))` for each
  artist.

- Decorating a class with `docstring.interpd` will now also perform
  interpolation over the docstring of the class' `__init__`, making it
  possible to list properties here as well, instead of having to
  manually call `docstring.interpd` after the class has been defined.

The new behavior is also explained in documenting_mpl.rst.  I think it's
slightly more magical, but also easier to explain...
@jklymak jklymak marked this pull request as draft May 20, 2021 23:57
@jklymak jklymak marked this pull request as ready for review May 24, 2021 15:26
@jklymak jklymak merged commit ca6e9dc into matplotlib:master May 24, 2021
@anntzer anntzer deleted the autokwdoc branch May 24, 2021 18:24
@QuLogic QuLogic added this to the v3.5.0 milestone May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0