Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Move from @cbook.deprecated to @_api.deprecated #18823

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

Conversation

timhoffm
Copy link
Member

PR Summary

Follow-up to #18657, which moved the functions. This PR now starts to move their usages in our code base.

@timhoffm timhoffm added this to the v3.4.0 milestone Oct 26, 2020
@QuLogic
Copy link
Member

QuLogic commented Oct 27, 2020

Mostly looking okay, but you have many missing references.

@QuLogic
Copy link
Member

QuLogic commented Oct 27, 2020

Actually, no not okay, _api does not expose any of the deprecation machinery directly like that.

@timhoffm timhoffm marked this pull request as draft October 27, 2020 09:03
@timhoffm timhoffm force-pushed the update-deprecation-api branch 2 times, most recently from 51444ba to be20463 Compare October 29, 2020 22:08
@timhoffm timhoffm force-pushed the update-deprecation-api branch from be20463 to 47f73d7 Compare October 29, 2020 23:15
@timhoffm timhoffm marked this pull request as ready for review October 30, 2020 00:13
@brunobeltran
Copy link
Contributor

brunobeltran commented Nov 4, 2020

Why not just from _api.deprecation import deprecated? Instead of just making _api the new catch-all name space for helper functions?

Don't really have a strong opinion here but I figure you've given it some thought so wanted to know.

@timhoffm
Copy link
Member Author

timhoffm commented Nov 4, 2020

I'm a bit paranoid by now concerning semi-public API. Importing deprecated leaks the name into the module namespace. - I know that other imports do that as well, but we can prevent in this case quite easily.

Also, I don't want to import the specific functions (check_in_List, warn_deprecated, make_keyword_only, rename_parameter, ...) and remove the imports when they expire. That's a big back and forth adapting of the imports. One could even consider inlining the deprecation module into _api, but for now I'd leave it as a sub module.

Furthermore, I like the _api prefix indicating the context. For example it makes it immediately clear, that _api.check_in_list() is some sort of standard function within our framework and not only a local helper function check_in_list().

Copy link
Contributor

@brunobeltran brunobeltran left a comment

Choose a reason for hiding this comment

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

I'm convinced by the argument that everything should live under _api. At that point, I would honestly prefer if everything was just inlined into _api directly (especially since I'm about to move one random function into _api.deprecation just to avoid circular imports (#18817)), but it doesn't seem like doing it this way for now fundamentally hurts our ability to do differently moving forward so...it'd be good to get this in.

@QuLogic QuLogic merged commit 1c20824 into matplotlib:master Nov 5, 2020
@timhoffm timhoffm deleted the update-deprecation-api branch November 5, 2020 12:06
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