-
Notifications
You must be signed in to change notification settings - Fork 514
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
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
sentry_sdk/integrations/flask.py
Outdated
@@ -44,6 +44,8 @@ | |||
except ImportError: | |||
raise DidNotEnable("blinker is not installed") | |||
|
|||
installed_packages = _get_installed_modules() | |||
FLASK_VERSION = installed_packages("flask") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_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.
sentry_sdk/integrations/flask.py
Outdated
@@ -44,6 +44,7 @@ | |||
except ImportError: | |||
raise DidNotEnable("blinker is not installed") | |||
|
|||
FLASK_VERSION = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
--------- Co-authored-by: Ivana Kellyerova <[email protected]>
Creating a fix for #2316