-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Mark Extra as deprecated
#7299
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
Mark Extra as deprecated
#7299
Conversation
|
please review |
|
I just pushed a commit that I think should make the test pass by suppressing the deprecation warning for the instantiation of the Also, it would be good if you could confirm that with the changes I pushed it still shows the deprecation properly — I use PyCharm which doesn't reflect that decorator properly yet 😕. |
Kludex
left a comment
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.
This doesn't work as expected on VSCode because of the reexport on config.py, and the instantiation of _Extra().
pydantic/config.py
Outdated
| # so it is okay to suppress the one coming from the @deprecated decorator here. | ||
| warnings.filterwarnings('ignore', category=PydanticDeprecatedSince20) | ||
|
|
||
| Extra = _Extra() |
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.
Why is it Extra = _Extra() and not Extra = _Extra?
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.
I've completely removed the instantiation of Extra now so that it is only re-exported same as BaseConfig
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.
getattr(Extra, attribute) doesn't seem to work without instantiating it first
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.
I've reverted the change
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.
@Kludex I think we can make that work but then we need to override getattribute on the metaclass. Might help to go over it live so we can confirm it's working with display etc.
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.
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.
I'm taking over. Thanks @disrupted 🙏
d99724c to
ea8538b
Compare
Change Summary
Similary to the
BaseConfig,Extrais now marked using the@deprecateddecorator for IDE support to advise against its usage.Related issue number
Checklist
Selected Reviewer: @dmontagu