Skip to content

sentry_sdk.init(disable_integration=...) annotation incorrect #7460

Description

@jap

How do you use Sentry?

Self-hosted/on-premise

Version

the latest

Steps to Reproduce

We're running code which disables an integration by calling

sentry.init(
    ...,
    disabled_integrations=[sentry_sdk.integrations.falcon.FalconIntegration]
)

and mypy (rightfully) complains about this:

error: List item 0 has incompatible type "type[FalconIntegration]"; expected "Integration"  [list-item]

The annotation in https://github.com/getsentry/sentry-python/blob/a618e3a3df9a7b1bbb09d38f1b38fbd5876df622/sentry_sdk/consts.py#L1340should be fixed to allow Optional[Sequence[Integration | type[Integration]] instead. Not sure if anyone passes Integration in directly here - I don't expect those integrations to be singletons - so maybe just type[Integration] suffices as well.

disabled_integrations: "Optional[Sequence[Union[type[Integration], Integration]]]" = None,
already has the correct annotation.

Expected Result

mypy not complaining

Actual Result

mypy complains

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions