Skip to content

Commit 6842773

Browse files
committed
add implementation plan; add static type checking test; add audit file
1 parent 1c7d45c commit 6842773

File tree

6 files changed

+685
-117
lines changed

6 files changed

+685
-117
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- [ ] I did **not** use any AI-assistance tools to help create this pull request.
2+
- [x] I **did** use AI-assistance tools to *help* create this pull request.
3+
- [x] I have read, understood and followed the project's AI_POLICY.md when creating code, documentation etc. for this pull request.
4+
5+
Submitted by: @oberstet
6+
Date: 2026-01-14
7+
Related issue(s): #1839
8+
Branch: oberstet:strict-typing-test

docs/architecture/statically-typed-region-lifecycle-python.md

Lines changed: 511 additions & 0 deletions
Large diffs are not rendered by default.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Contents
4545
installation
4646
getting-started
4747
programming-guide/index
48+
architecture/statically-typed-region-lifecycle-python.md
4849
release-notes
4950
changelog
5051
contributing

justfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,22 @@ check-typing venv="": (install venv)
717717
--ignore deprecated \
718718
src/autobahn/
719719

720+
# pyright --project pyproject-static-typing.toml src/autobahn/wamp/request.py
721+
# mypy --config-file pyproject-static-typing.toml src/autobahn/wamp/request.py
722+
# check-static-typing-subset venv="": (install-tools venv)
723+
check-static-typing-subset venv="":
724+
#!/usr/bin/env bash
725+
726+
echo "=================================================================="
727+
echo " Checking for statically typed Python with pyright:"
728+
echo "------------------------------------------------------------------"
729+
pyright --project pyproject-static-typing.toml src/autobahn/wamp/message.py
730+
echo "=================================================================="
731+
echo " Checking for statically typed Python with mypy:"
732+
echo "------------------------------------------------------------------"
733+
mypy --config-file pyproject-static-typing.toml src/autobahn/wamp/message.py
734+
echo "=================================================================="
735+
720736
# Run coverage for Twisted tests only
721737
check-coverage-twisted venv="" use_nvx="": (install-tools venv) (install-dev venv)
722738
#!/usr/bin/env bash

pyproject-static-typing.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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

Comments
 (0)