Skip to content

pkg_resources is deprecated as an API #2048

@ramnes

Description

@ramnes

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.21.0

Steps to Reproduce

  1. Ran my project tests suite
  2. Saw the warning DeprecationWarning: pkg_resources is deprecated as an API
  3. Ran again with pytest -W error to get the following stack trace

Expected Result

No warning.

Actual Result

ImportError while loading conftest 'tests/conftest.py'.
tests/__init__.py:3: in <module>
    from api import app
api/__init__.py:59: in <module>
    app.add_middleware(SentryAsgiMiddleware)
../.venv/lib/python3.10/site-packages/starlette/applications.py:169: in add_middleware
    self.middleware_stack = self.build_middleware_stack()
../.venv/lib/python3.10/site-packages/fastapi/applications.py:195: in build_middleware_stack
    app = cls(app=app, **options)
../.venv/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py:111: in __init__
    mechanism_type == "asgi" and "starlette" in _get_installed_modules()
../.venv/lib/python3.10/site-packages/sentry_sdk/integrations/modules.py:36: in _get_installed_modules
    _installed_modules = dict(_generate_installed_modules())
../.venv/lib/python3.10/site-packages/sentry_sdk/integrations/modules.py:24: in _generate_installed_modules
    import pkg_resources
../.venv/lib/python3.10/site-packages/pkg_resources/__init__.py:121: in <module>
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
E   DeprecationWarning: pkg_resources is deprecated as an API

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions