Skip to content

Commit

Permalink
Update to mypy 0.900+, move config to pyproject.toml, and install sep…
Browse files Browse the repository at this point in the history
…arate type stubs for requests and dateutil
  • Loading branch information
JWCook committed Jun 8, 2021
1 parent 9c315cb commit 9a206dd
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 59 deletions.
127 changes: 75 additions & 52 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinaturalist/response_format.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" Helper functions for formatting API responses """
# TODO: Should most formatting/converting be handled by attrs converters?
from datetime import datetime, timedelta
from dateutil.parser import UnknownTimezoneWarning # type: ignore # (missing from type stubs)
from dateutil.parser import parse as parse_date
from dateutil.parser._parser import UnknownTimezoneWarning
from dateutil.tz import tzoffset
from logging import getLogger
from typing import Any, Dict, Iterable, List, Optional, Union
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ black = {version = "21.5b0", python = ">=3.6.2, <3.10"}
ipython = {version = ">=7.23", python = "^3.7"}
isort = ">=5.8"
flake8 = "^3.9"
mypy = "^0.812"
mypy = "^0.901"
pre-commit = {version = "^2.12", python = "^3.6.2"}
pytest = "^6.2"
pytest-cov = ">=2.11"
pytest-xdist = ">=2.2"
requests-mock = "^1.8"
rich = ">=10.0"
types-python-dateutil = ">=0.1.2"
types-requests = ">=0.1.8"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand All @@ -91,3 +93,7 @@ skip = ['pyinaturalist/__init__.py', 'pyinaturalist/models/__init__.py']
known_first_party = ['test']
# Things that are common enough they may as well be grouped with stdlib imports
extra_standard_library = ['dateutil', 'pytest', 'setuptools']

[tool.mypy]
ignore_missing_imports = true
exclude = "/examples|docs|downloads|dist|build|test/"
5 changes: 0 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,3 @@ ignore =
E501 # line too long
W503 # line break before binary operator
W504 # line break after binary operator

# Tell mypy to ignore external libraries without type annotations
[mypy]
ignore_missing_imports = True
exclude = /examples|docs|downloads|dist|build|test/

0 comments on commit 9a206dd

Please sign in to comment.