Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Commit

Permalink
Add mypy config to gradually roll out types
Browse files Browse the repository at this point in the history
Add mypy config to gradually roll out types in the code base. The
configured tox environment will not run unless explicitly specified
(with tox -e types).

The mypy config will ignore all files that have not been opted in,
allowing a gradual roll out through the codebase.
  • Loading branch information
vikahl committed Aug 5, 2021
1 parent b5d157a commit 4a560cb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,33 @@ line_length = 120

[tool.black]
line-length = 120

[tool.mypy]
ignore_missing_imports = true
warn_unused_configs = true
disallow_any_generics = true
disallow_subclassing_any = true
# disallow_untyped_calls = true # temp disabled
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
no_implicit_reexport = true
strict_equality = true
plugins = "sqlmypy"

# Gradually roll out mypy by ignoring all files not explicitly opted in.
[[tool.mypy.overrides]]
module = "comet_core.*"
ignore_errors = true

[[tool.mypy.overrides]]
module = [
"comet_core.data_store",
"comet_core.models"
]
ignore_errors = false
17 changes: 14 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Install the package itself in dev mode
-e .

tox==3.24.1

# Formatters and linters
black==21.7b0
pylint==2.9.6
isort==5.8.0

# Testing
pytest==6.2.4
pytest-cov==2.12.0
pytest-freezegun==0.4.2
tox==3.24.1
pylint==2.9.6
isort==5.8.0

# Types
mypy==0.910
sqlalchemy-stubs==0.4
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,13 @@ commands =
[testenv:lint]
basepython = python3.6
deps = -rrequirements-dev.txt
skip_install = true
commands =
python3 -m pylint --rcfile={toxinidir}/.pylintrc {toxinidir}/comet_core {toxinidir}/tests

[testenv:types]
basepython = python3.6
deps = -rrequirements-dev.txt
skip_install = true
commands =
python3 -m mypy --config {toxinidir}/pyproject.toml {toxinidir}/comet_core

0 comments on commit 4a560cb

Please sign in to comment.