Got SentryHubDeprecationWarning without sentry_sdk.init
When I run my tests, I get SentryHubDeprecationWarning warnings even though I don’t initialize Sentry anywhere in the tests. Perhaps here it would make sense to check whether Sentry has actually been initialized, rather than just checking for the presence of the installed package. I found a solution here The Python equivalent would look like this:
is_init = sentry_sdk.Hub.current.client is not None
Can you check it in your environment? I mean, change the local line and see if the warning is still present.
Yes, I’ve already tested it locally and the warning does appear. You can also reproduce it using the example from the README by installing sentry_sdk. If you call the echo method, you’ll see the warning:
python test.py
INFO: Started server process [25349]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:5000 (Press CTRL+C to quit)
.venv/lib/python3.13/site-packages/fastapi_jsonrpc/__init__.py:656: UserWarning: Implicit Sentry integration is deprecated and may be removed in a future major release. To ensure compatibility, use sentry-sdk 2.* and explicit integration:`from fastapi_jsonrpc.contrib.sentry import FastApiJsonRPCIntegration`.
warnings.warn(
Once sentry_sdk is removed, the warning no longer shows up.