Emit prominent MigrationWarning instead of breaking InferenceData import#2575
Merged
aloctavodia merged 3 commits intoarviz-devs:mainfrom Apr 24, 2026
Merged
Conversation
dee5b64 to
15f43f1
Compare
aloctavodia
reviewed
Apr 21, 2026
|
|
||
| class MigrationError(RuntimeError): | ||
| """Error raised when a legacy name is accessed on the ``arviz`` namespace.""" | ||
| class MigrationWarning(DeprecationWarning): |
Contributor
There was a problem hiding this comment.
Suggested change
| class MigrationWarning(DeprecationWarning): | |
| class MigrationWarning(FutureWarning): |
DeprecationWarning is intended for devs and is less visible than FutureWarning.
Member
There was a problem hiding this comment.
I would actually argue it should be a subclass of UserWarning. It is very much a present issue and the vast majority of InferenceData use will be broken now. Only type hints, and things like isinstance(...) or calling a handful of methods without keyword arguments will continue to work.
Contributor
Author
There was a problem hiding this comment.
I subclassed it from both warning types; UserWarning first
Contributor
|
The 1.0 release was more than one month ago. But yeah, we can consider this PR. |
Contributor
|
The error with the docs is unrelated to this PR and it has been addressed elsewhere. |
aloctavodia
approved these changes
Apr 23, 2026
Merged
Contributor
|
I also support this PR! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 1.0 release is not even a week old and I already have colleagues running into import errors :(
In today's case it's with cases where we have PyMC versions pinnend and the import in PyMC at the time was not yet ArviZ 1.0 compatible.
Please consider this PR which will still bombard users with prominent deprecation warnings upon import, but give library maintainers and dev-ops people some time to fix all the places that are not directly under the control of the end user.