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

remove __version__ #260

Merged
merged 3 commits into from
Apr 30, 2024
Merged

remove __version__ #260

merged 3 commits into from
Apr 30, 2024

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("flask-debugtoolbar") can be used to get the version at runtime in a standard way, if it's really needed.

This matches what we've already done in the Pallets projects.

src/flask_debugtoolbar/__init__.py Outdated Show resolved Hide resolved
@davidism davidism changed the title deprecate __version__ remove __version__ Apr 30, 2024
@davidism
Copy link
Member Author

I've removed __version__ based on review. I also changed the Jinja extension compatibility to use feature detection instead of examining the version, which is exactly the advice I gave in the PR description ;-)

@davidism davidism merged commit a2a2b13 into main Apr 30, 2024
9 checks passed
@davidism davidism deleted the deprecate-version branch April 30, 2024 22:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants