Skip to content

Conversation

@davidism
Copy link
Member

The __version__ attribute is an old pattern from early in Python packaging. Setuptools eventually made it easier to use the pattern by allowing reading the value from the attribute at build time, and some other build backends have done the same.

However, there's no reason to expose this directly in code anymore. It's usually easier to use feature detection (hasattr, try/except) instead. importlib.metadata.version("markupsafe") can be used to get the version at runtime in a standard way, if it's really needed.


Also, given some of the changes going into the next version, 3.0 feels more appropriate than 2.2.

@davidism davidism added this to the 2.2.0 milestone Sep 15, 2023
@davidism davidism merged commit 4afaf1a into main Sep 15, 2023
@davidism davidism deleted the deprecate-version branch September 15, 2023 19:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants