-
Notifications
You must be signed in to change notification settings - Fork 947
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
fix: make .widget and .widget_types deprecated #3567
fix: make .widget and .widget_types deprecated #3567
Conversation
In jupyter-widgets#3122 we renamed .widget and .widget_types to ._active_widgets and ._widget_types. That breaks code, and we did not have a deprecation period. This PR makes the dict and registry non-members of the Widget class and puts in a backwards compatible way the deprecated these members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two conventions for module-level variables I see in pep8 are:
(Let’s hope that these variables are meant for use inside one module only.) The conventions are about the same as those for functions.
Modules that are designed for use via from M import * should use the all mechanism to prevent exporting globals, or use the older convention of prefixing such globals with an underscore (which you might want to do to indicate these globals are “module non-public”).
and Constants:
Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL.
What do you think about making instances either _instances
or INSTANCES
(and same for registry).
Co-authored-by: Jason Grout <[email protected]>
Co-authored-by: Jason Grout <[email protected]>
To fully close #3562 I think we should also add a note to the migration guide about this. |
@maartenbreddels - I switched the internal imports to relative imports, and added a note to the migration docs like Vidar suggested in maartenbreddels#2 - can you take a look? |
Move internal references to relative imports, add migration note
This introduced a small issue, referring to A prospective fix is up in #3653. |
In #3122 we renamed .widget and .widget_types to ._active_widgets
and ._widget_types. That breaks code, and we did not have a deprecation
period.
This PR makes the dict and registry non-members of the Widget class
and puts in a backwards compatible way to deprecated these members.
Closes #3562