Sentry integration and the latest py2neo issue

In case anyone uses Sentry SDK 0.19.5 on the latest open-release/koa.master branch there is an issue during deployment procedure:

1706      File "/edx/app/edxapp/edx-platform/cms/envs/production.py", line 589, in <module>
1707        sentry_sdk.init(
1708      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/hub.py", line 105, in _init
1709        client = Client(*args, **kwargs)  # type: ignore
1710      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/client.py", line 88, in __init__
1711        self._init_impl()
1712      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/client.py", line 130, in _init_impl
1713        self.integrations = setup_integrations(
1714      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/integrations/__init__.py", line 120, in setup_integrations
1715        type(integration).setup_once()
1716      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/integrations/bottle.py", line 62, in setup_once
1717        raise DidNotEnable("Unparsable Bottle version: {}".format(version))
1718    UnboundLocalError: local variable 'version' referenced before assignment

Root cause of the issue is the following py2neo repo’s line in the bottle.py file which causes the Exception during the following code in the sentry logic:

Traceback (most recent call last):
      File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sentry_sdk/integrations/bottle.py", line 60, in setup_once
        version = tuple(map(int, BOTTLE_VERSION.split(".")))
    ValueError: invalid literal for int() with base 10: '13-dev'

I’ve managed to fix it by adding an option auto_enabling_integrations=False to the sentry sdk init code:

sentry_sdk.init(
  ...
  auto_enabling_integrations=False,
  integrations=[DjangoIntegration(), CeleryIntegration()],
  ...)

Auto integration sometimes is a good option so I will try to find another way to work with the py2neo package installed from GitHub with -e flag but it would be much better to get back the wheel package from pypi.