Avoid import of pkg_resource with Starlette integration by mgu · Pull Request #1836 · getsentry/sentry-python · GitHub
Skip to content

Avoid import of pkg_resource with Starlette integration#1836

Merged
antonpirker merged 2 commits into
getsentry:masterfrom
mgu:master
Jan 19, 2023
Merged

Avoid import of pkg_resource with Starlette integration#1836
antonpirker merged 2 commits into
getsentry:masterfrom
mgu:master

Conversation

@mgu

@mgu mgu commented Jan 14, 2023

Copy link
Copy Markdown
Contributor

By changing the order in the condition, we can avoid the call to _get_installed_modules at import time (which imports pkg_resources) when the mechanism_type is set to "starlette".

I have validated the change using PYTHONPROFILEIMPORTTIME=1.

Tell me if such a change requires a link to an issue or some testing.

By changing the order in the condition, we can avoid the call to
`_get_installed_modules` (which imports `pkg_resources`) when the
`mechanism_type` is set to `"starlette"`.
@antonpirker antonpirker enabled auto-merge (squash) January 19, 2023 10:54
@antonpirker antonpirker merged commit f6af7a0 into getsentry:master Jan 19, 2023
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.

2 participants