|
| 1 | +############################################################################### |
| 2 | +# Fully statically typed Python => CI job mypy-strict-check |
| 3 | +# |
| 4 | +# - this is checked via both pyright and mypy |
| 5 | +# - ty is sadly not quite yet there (https://docs.astral.sh/ty/reference/typing-faq/#does-ty-have-a-strict-mode) |
| 6 | +# |
| 7 | +[tool.pyright] |
| 8 | +strict = [ |
| 9 | +# "src/autobahn/wamp/request.py", |
| 10 | +# "src/autobahn/wamp/exception.py", |
| 11 | +# "src/autobahn/wamp/uri.py", |
| 12 | + "src/autobahn/wamp/message.py", |
| 13 | +] |
| 14 | + |
| 15 | +[tool.mypy] |
| 16 | +mypy_path = "src" |
| 17 | + |
| 18 | +# "strict" is global-only and can't be used in per-module overrides |
| 19 | +# https://github.com/python/mypy/issues/11401 |
| 20 | +strict = false |
| 21 | + |
| 22 | +# some flags are global-only and can't be used in per-module overrides |
| 23 | +warn_redundant_casts = true |
| 24 | + |
| 25 | +[[tool.mypy.overrides]] |
| 26 | + |
| 27 | +# this is the "whitelist" of sources/modules which _are_ statically typed: |
| 28 | +module = [ |
| 29 | +# "autobahn.wamp.request", |
| 30 | +# "autobahn.wamp.exception", |
| 31 | +# "autobahn.wamp.uri", |
| 32 | + "autobahn.wamp.message", |
| 33 | +] |
| 34 | + |
| 35 | +strict_equality = true |
| 36 | +warn_unused_ignores = true # clean up technical debt |
| 37 | +warn_return_any = true # don't let functions return Any |
| 38 | +warn_unreachable = true # catch dead code from type narrowing |
| 39 | +check_untyped_defs = true # type check inside untyped functions |
| 40 | +no_implicit_reexport = true |
| 41 | +no_implicit_optional = true # no "x: str = None" |
| 42 | +disallow_untyped_defs = true # all functions must be typed |
| 43 | +disallow_incomplete_defs = true |
| 44 | +disallow_untyped_decorators = true |
| 45 | +disallow_any_generics = true # no bare list, dict, etc.: List[Any] -> List[str] |
| 46 | +disallow_subclassing_any = true # can't subclass untyped imports |
| 47 | +disallow_any_unimported = true # Any from missing stubs → error |
| 48 | +disallow_any_explicit = true # forbid explicit Any annotations |
| 49 | +disallow_any_decorated = true # Any in decorated function signatures |
| 50 | + |
| 51 | +# The Killer Flag for WASM: |
| 52 | +disallow_any_expr = true # ANY use of Any-typed expression is an error |
| 53 | + |
| 54 | +# |
| 55 | +############################################################################### |
0 commit comments