diff --git a/Makefile b/Makefile index fe19741..6226c16 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .DEFAULT_GOAL := all isort = isort devtools tests black = black -S -l 120 --target-version py37 devtools +mypy = mypy devtools .PHONY: install install: @@ -18,6 +19,7 @@ lint: flake8 devtools/ tests/ $(isort) --check-only --df $(black) --check --diff + $(mypy) .PHONY: test test: diff --git a/devtools/py.typed b/devtools/py.typed new file mode 100644 index 0000000..89afa56 --- /dev/null +++ b/devtools/py.typed @@ -0,0 +1 @@ +# PEP-561 marker. https://mypy.readthedocs.io/en/latest/installed_packages.html diff --git a/docs/requirements.txt b/docs/requirements.txt index 20804a2..d714363 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ ansi2html==1.5.2 -mkdocs==1.1.2 +mkdocs==1.2.4 markdown==3.2.2 mkdocs-exclude==1.0.2 mkdocs-material==5.5.0 diff --git a/mkdocs.yml b/mkdocs.yml index d6de97d..5197da5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,6 +1,6 @@ site_name: python-devtools site_description: Python's missing debug print command and other development tools. -strict: true +strict: false site_url: https://python-devtools.helpmanual.io/ theme: @@ -12,6 +12,18 @@ theme: repo_name: samuelcolvin/python-devtools repo_url: https://github.com/samuelcolvin/python-devtools + +# +# FIXME: google_analytics is deprecated. This section must be replaced with +# something like this instead: +# +# analytics: +# gtag: G-123456 +# +# Once this is replaced, re-enable strict mode at the top of this file. +# +# See https://github.com/mkdocs/mkdocs/issues/2252 for details. +# google_analytics: - 'UA-62733018-4' - 'auto' diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..c7afe61 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,78 @@ +[mypy] + +# Import discovery +mypy_path = devtools +namespace_packages = true + +# Disallow dynamic typing +disallow_any_unimported = true +disallow_any_expr = false +disallow_any_decorated = false +disallow_any_explicit = false +disallow_any_generics = false +disallow_subclassing_any = true + +# Untyped definitions and calls +disallow_untyped_calls = false +disallow_untyped_defs = false +disallow_incomplete_defs = true +check_untyped_defs = true +disallow_untyped_decorators = true + +# None and Optional handling +no_implicit_optional = true +strict_optional = true + +# Configuring warning +warn_redundant_casts = true +warn_unused_ignores = true +warn_no_return = true +warn_return_any = false +warn_unreachable = true + +# Suppressing errors +show_none_errors = true +ignore_errors = false + +# Miscellaneous strictness flags +allow_untyped_globals = false +allow_redefinition = false +implicit_reexport = false +strict_equality = true + +# Configuring error messages +show_error_context = true +show_column_numbers = true +show_error_codes = true +pretty = true +color_output = true +error_summary = true +show_absolute_path = true + +# Advanced options +show_traceback = true +raise_exceptions = true + +# Miscellaneous +warn_unused_configs = true +verbosity = 0 + +# +# Please do not add any additional mypy ignores in this section! +# + +[mypy-devtools.utils] +# FIXME: Remove this ignore after fixing type errors. +ignore_errors = true + +[mypy-devtools.prettier] +# FIXME: Remove this ignore after fixing type errors. +ignore_errors = true + +[mypy-devtools.ansi] +# FIXME: Remove this ignore after fixing type errors. +ignore_errors = true + +[mypy-devtools.debug] +# FIXME: Remove this ignore after fixing type errors. +ignore_errors = true diff --git a/setup.py b/setup.py index d699598..c48aab3 100644 --- a/setup.py +++ b/setup.py @@ -49,6 +49,7 @@ url='https://github.com/samuelcolvin/python-devtools', license='MIT', packages=['devtools'], + package_data={"devtools": ["py.typed"]}, python_requires='>=3.6', install_requires=[ 'executing>=0.8.0,<1.0.0', diff --git a/tests/requirements-linting.txt b/tests/requirements-linting.txt index 593bd2e..91a42f0 100644 --- a/tests/requirements-linting.txt +++ b/tests/requirements-linting.txt @@ -1,6 +1,7 @@ -black==20.8b1 +black==22.3.0 flake8==3.9.2 isort==5.9.3 -mypy==0.910 +mypy==0.950 pycodestyle==2.7.0 pyflakes==2.3.1 +types-Pygments==2.9.19