DataDog / datadogpy

The Datadog Python library
https://datadoghq.com/
Other
611 stars 302 forks source link

Mypy error: Module "datadog" does not explicitly export attribute "statsd" [attr-defined] #842

Open tuukkamustonen opened 3 months ago

tuukkamustonen commented 3 months ago
from datadog import statsd

Mypy nags:

foo.py:1: error: Module "datadog" does not explicitly export attribute "statsd"  [attr-defined]

That's because datadog.__init__ doesn't explicitly expose the module imported in its __all__ = []. See https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport.

mypy --strict enables that check, so I assume others will bump into it, too.

datadog==0.49.1
mypy=1.10.0
github-actions[bot] commented 2 months ago

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

tuukkamustonen commented 1 month ago

Your bot here is quite aggressive. A bit ridiculous to close tickets after 30d. 180d or such would make more sense.

Yes, I believe the issue is still valid.

JakubOrsula commented 1 week ago

I can confirm that the issue is still reproducible on mypy==1.11.2, datadog==0.50.0 and python 3.12.

JakubOrsula commented 1 week ago

If you want to avoid # noqa or # type:ignore use

from datadog.dogstatsd.base import statsd