Skip to content

Commit

Permalink
ref(mypy): don't ignore missing imports by default (#486)
Browse files Browse the repository at this point in the history
Now we explicitly ignore specific imports instead of a blanket ignore
on all missing types.

Upgraded databases and pytest to get their latest versions which include
types, for the rest we're ignoring them explicitly.
see #485

- arrow

  doesn't have types but we can replace it with std library calls

- requests_async

  deprecated in favor of httpx, so we'd need to upgrade to get types.
  The API of httpx is a little different as well.

- structlog

  doesn't have types currently

  hynek/structlog#165

- rure

  No stubs yet

  davidblewett/rure-python#23

- pytest_mock

  types recently added to the typeshed so we'll need to wait for the next
  release of mypy.

  pytest-dev/pytest-mock#152

- markdown_html_finder

  Wrapper around some Rust code. Needs stubs to be added.

  chdsbd/markdown-html-finder#5

- asyncio_redis

  We're using our own fork of it, but adding types would be rather manual.
  Granted we aren't using that much of the API surface.

  https://github.com/chdsbd/asyncio-redis

- zstandard

  No stubs yet, so we're ignoring for the time being

  indygreg/python-zstandard#120

- inflection

  Types, but I think they're misconfigured, once they're fixed we can
  unignore.

  jpvanhal/inflection#49

- django

  Need to setup django-stubs for this to work since django doesn't have
  any static types.

  https://github.com/TypedDjango/django-stubs

- dj_database_url

  Doesn't have any static types yet

  jazzband/dj-database-url#135

- responses

  No types yet

  getsentry/responses#339

- stripe

  Plan for types, but they don't exist currently

  stripe/stripe-python#650
  • Loading branch information
sbdchd authored Aug 11, 2020
1 parent 7721cdc commit 382b511
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
30 changes: 28 additions & 2 deletions bot/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ show_column_numbers=True
# show error messages from unrelated files
follow_imports=normal

# suppress errors about unsatisfied imports
ignore_missing_imports=True
# don't suppress errors about unsatisfied imports
ignore_missing_imports=False

# be strict
disallow_untyped_calls=True
Expand All @@ -34,6 +34,32 @@ check_untyped_defs=True
# enable pydantic mypy plugin.
plugins = pydantic.mypy

[mypy-arrow.*]
ignore_missing_imports=True

[mypy-requests_async.*]
ignore_missing_imports=True

[mypy-structlog.*]
ignore_missing_imports=True

[mypy-rure.*]
ignore_missing_imports=True

[mypy-pytest_mock.*]
ignore_missing_imports=True

[mypy-markdown_html_finder.*]
ignore_missing_imports=True

[mypy-asyncio_redis.*]
ignore_missing_imports=True

[mypy-zstandard.*]
ignore_missing_imports=True

[mypy-inflection.*]
ignore_missing_imports=True

# https://pydantic-docs.helpmanual.io/mypy_plugin/#plugin-settings
[pydantic-mypy]
Expand Down
22 changes: 20 additions & 2 deletions web_api/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ show_column_numbers=True
# show error messages from unrelated files
follow_imports=normal

# suppress errors about unsatisfied imports
ignore_missing_imports=True
# don't suppress errors about unsatisfied imports
ignore_missing_imports=False

# be strict
disallow_untyped_calls=True
Expand All @@ -34,6 +34,24 @@ check_untyped_defs=True
# enable pydantic mypy plugin.
plugins = pydantic.mypy

[mypy-django.*]
ignore_missing_imports=True

[mypy-dj_database_url.*]
ignore_missing_imports=True

[mypy-zstandard.*]
ignore_missing_imports=True

[mypy-responses.*]
ignore_missing_imports=True

[mypy-stripe.*]
ignore_missing_imports=True

[mypy-pytest_mock.*]
ignore_missing_imports=True


# https://pydantic-docs.helpmanual.io/mypy_plugin/#plugin-settings
[pydantic-mypy]
Expand Down

0 comments on commit 382b511

Please sign in to comment.