Skip to content

Type checking improvements #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -18,6 +19,7 @@ lint:
flake8 devtools/ tests/
$(isort) --check-only --df
$(black) --check --diff
$(mypy)

.PHONY: test
test:
Expand Down
1 change: 1 addition & 0 deletions devtools/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PEP-561 marker. https://mypy.readthedocs.io/en/latest/installed_packages.html
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 13 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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'
Expand Down
78 changes: 78 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions tests/requirements-linting.txt
Original file line number Diff line number Diff line change
@@ -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