Skip to content

Commit 6ab3d23

Browse files
committed
Convert to newer mypy overrides config + update
This allows us to do per-file overrides in pyproject.toml, as was previously only possible in a separate mypy.ini At the same time, refine the configuration as follows: - check the list of options for `--strict` under the current `mypy` version, and expand our config - comment out, with notes, the new checks which fail - note warn_unreachable as not being part of strict mode - slightly tweak tox.ini to make it easier to test these sorts of changes and iterate
1 parent 1031831 commit 6ab3d23

File tree

3 files changed

+47
-40
lines changed

3 files changed

+47
-40
lines changed

Diff for: mypy.ini

-39
This file was deleted.

Diff for: pyproject.toml

+46
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,49 @@ categories = "Bugfixes, Enhancements, Other"
7777
format = "md"
7878
output_file = "changelog.adoc"
7979
entry_title_template = '{{ version }} ({{ date.strftime("%Y-%m-%d") }})'
80+
81+
[tool.mypy]
82+
# the desired config here is
83+
# strict=true
84+
# however, strict=true does not play well with overrides (used below)
85+
# therefore, we explicitly declare a number of options which approach
86+
# `strict=true` in effect
87+
warn_unused_configs = true
88+
89+
# TODO: enable disallow_any_generics (currently fails)
90+
# disallow_any_generics = true
91+
disallow_subclassing_any = true
92+
93+
# do not disallow_untyped_calls, as we have untyped defs of our own
94+
# this rule causes too much chaos at present
95+
#
96+
# disallow_untyped_calls = true
97+
98+
disallow_untyped_defs = true
99+
disallow_incomplete_defs = true
100+
check_untyped_defs = true
101+
disallow_untyped_decorators = true
102+
warn_redundant_casts = true
103+
warn_unused_ignores = true
104+
warn_return_any = true
105+
no_implicit_reexport = true
106+
strict_equality = true
107+
extra_checks = true
108+
109+
# additional settings (not part of strict=true)
110+
warn_unreachable = true
111+
112+
[[tool.mypy.overrides]]
113+
disallow_untyped_defs = false
114+
disallow_incomplete_defs = false
115+
module = [
116+
"globus_cli.services.gcs",
117+
"globus_cli.services.transfer.activation",
118+
"globus_cli.services.transfer.client",
119+
"globus_cli.services.transfer.delegate_proxy",
120+
"globus_cli.services.transfer.recursive_ls",
121+
"globus_cli.termio",
122+
"globus_cli.termio.printer",
123+
"globus_cli.termio.errors",
124+
"globus_cli.termio.awscli_text",
125+
]

Diff for: tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ deps =
7474
types-jwt
7575
types-requests
7676
types-jmespath
77-
commands = mypy src/
77+
commands = mypy {posargs:src/}
7878

7979
[testenv:reference]
8080
allowlist_externals = find

0 commit comments

Comments
 (0)