Skip to content
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

Deprecate __version__ and related attributes #2229

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Deprecate __version__ and related attributes #2229

merged 2 commits into from
Feb 12, 2024

Conversation

sloria
Copy link
Member

@sloria sloria commented Jan 19, 2024

close #2227

Follow-ups:

  • Remove usages of __version__ et al. in other marshmallow-code repos

@sloria sloria requested a review from lafrech January 19, 2024 05:51
Copy link
Member

@lafrech lafrech left a comment

Choose a reason for hiding this comment

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

Sorry, I missed this review requests.

Feel free to go ahead and apply this to all repos.

__version_info__ += __parsed_version__.pre # type: ignore[assignment]

def __getattr__(name: str) -> typing.Any:
import warnings
Copy link
Member

Choose a reason for hiding this comment

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

I suppose this is imported here to avoid a useless import in normal use.
I don't mind either way.

Copy link
Member Author

@sloria sloria Feb 12, 2024

Choose a reason for hiding this comment

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

This turns out to be necessary to avoid an error. If the import is moved to the top, you get

AttributeError: module 'marshmallow.warnings' has no attribute 'warn'

flask does the same https://github.com/pallets/flask/blob/b90a4f1f4a370e92054b9cc9db0efcb864f87ebe/src/flask/__init__.py#L49

Copy link
Member

Choose a reason for hiding this comment

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

Oh, OK. Strange at first sight, but alright.

@sloria sloria merged commit e140f7d into dev Feb 12, 2024
9 checks passed
@sloria sloria deleted the deprecate-version branch February 12, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate __version__ and related attributes
2 participants