8000 Add unobtrusive deprecation note to the first line of the docstring by timhoffm · Pull Request #12738 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add unobtrusive deprecation note to the first line of the docstring #12738

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 1 commit into from
Nov 5, 2018

Conversation

timhoffm
Copy link
Member
@timhoffm timhoffm commented Nov 4, 2018

PR Summary

As suggested in #12736 (review), this PR adds an unobtrusive "Deprecated." to the beginning of the docstring.

This is intended particularly for the summary.

grafik

A maybe slightly unwanted side-effect is that this is of course also present in the docstring, which is a duplication with the more verbose deprecation note.

grafik

However, every other way of adding such a not to the summary is far more complicated. It would have to happen within autosummary, which has to be patched or extended for that functionality. Also for a universal extension of autosummary, there would be the problem of detecting a deprecated method. So overall, the solution presented here is preferable due to its simplicity.

@timhoffm timhoffm added this to the v3.1 milestone Nov 4, 2018
@timhoffm
Copy link
Member Author
timhoffm commented Nov 4, 2018

Do we want this for 3.0.x docs? If so, we have to additionally backport #12736.

Copy link
Member
@ImportanceOfBeingErnest ImportanceOfBeingErnest left a comment

Choose a reason for hiding this comment

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

Easier than anticipated. I think this is very useful. The duplication is desireable in my eyes.

@jklymak
Copy link
Member
jklymak commented Nov 4, 2018

I found this confusing. Is it possible to do something like “Yet another arrow class (Deprecated)”? I wasn’t sure if the second phrase was meant to be the alternative or not.

@timhoffm
8000
Copy link
Member Author
timhoffm commented Nov 4, 2018

Is it possible to do something like “Yet another arrow class (Deprecated)”? I wasn’t sure if the second phrase was meant to be the alternative or not.

Likely yes, though we have would have to put a bit more work in. The first sentence could be multi-line, so you have to parse the old doc and insert the code at the right place. Also, there are some docstrings, which end with :: because they are followed by a code example (not sure if that's formally allowed, but we came across these in a recent PR - don't remember which). We'd have to insert before the :: to prevent breaking the ReStructuredText syntax.

Feel free to push changes.

Alternatively, would it already help your understanding if we add any sort of parentheses to the leading "Deprecated"?

@jklymak
Copy link
Member
jklymak commented Nov 4, 2018

Yeah that’s too much bother. It’s not that hard to read. If it were just up to me, I’d do “[Deprecated] Yet another....” but it’s not that big a deal.

@timhoffm timhoffm force-pushed the deprecation-summary branch from 0c7bc72 to 313f653 Compare November 4, 2018 21:45
@timhoffm
Copy link
Member Author
timhoffm commented Nov 4, 2018

Square brackets added.

grafik

@jklymak jklymak merged commit dc13966 into matplotlib:master Nov 5, 2018
@jklymak
Copy link
Member
jklymak commented Nov 5, 2018

Merged - think this looks good. OTOH if someone objects to the exact form, we can revisit....

@timhoffm timhoffm deleted the deprecation-summary branch November 5, 2018 18:31
@QuLogic QuLogic changed the title Add unobtrusive depreaction note to the first line of the docstring. Add unobtrusive deprecation note to the first line of the docstring Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0