Repository navigation
Fixing deprecated version attribute - #2338
Conversation
|
Heya @vagi8, thanks for the contribution! This will work, but not in Python versions lower than 3.8 since The good news is, there is already a place in the SDK where we gather all installed packages and their versions. Have a look at this: sentry-python/sentry_sdk/integrations/modules.py Lines 53 to 58 in 1f00437 |
sentrivana
left a comment
There was a problem hiding this comment.
See my previous comment. :)
|
Hey @sentrivana
|
|
Hey @vagi8. I'd go with option 2. The Let's please keep the leading underscore though, the intention there is to mark it as not part of the public API. |
| raise DidNotEnable("blinker is not installed") | ||
|
|
||
| installed_packages = _get_installed_modules() | ||
| FLASK_VERSION = installed_packages("flask") |
There was a problem hiding this comment.
_get_installed_modules() returns a dict, so you'd want:
| FLASK_VERSION = installed_packages("flask") | |
| FLASK_VERSION = installed_packages["flask"] |
I'm also thinking we could move these two lines into the setup_once method instead, so that all the version checking code is in one place.
…try-python into deprecate-version-attr
| except ImportError: | ||
| raise DidNotEnable("blinker is not installed") | ||
|
|
||
| FLASK_VERSION = None |
There was a problem hiding this comment.
Is this global variable needed? We only seem to be using FLASK_VERSION inside the setup_once function, so we just define and use it there?
sentrivana
left a comment
There was a problem hiding this comment.
Looking great @vagi8, thank you for the contribution! 🚀
One last thing: flake8 is complaining about the variable name now: sentry_sdk/integrations/flask.py:69:10: N806 variable 'FLASK_VERSION' in function should be lowercase, once we fix that we're good to merge 👍🏻
Head branch was pushed to by a user without write access
Co-authored-by: Ivana Kellyerova <ivana.kellyerova@sentry.io>
--------- Co-authored-by: Ivana Kellyerova <ivana.kellyerova@sentry.io>
Creating a fix for #2316