Skip to content
Open
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
8 changes: 8 additions & 0 deletions .audit/oberstet_strict-typing-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- [ ] I did **not** use any AI-assistance tools to help create this pull request.
- [x] I **did** use AI-assistance tools to *help* create this pull request.
- [x] I have read, understood and followed the project's AI_POLICY.md when creating code, documentation etc. for this pull request.

Submitted by: @oberstet
Date: 2026-01-14
Related issue(s): #1839
Branch: oberstet:strict-typing-test
511 changes: 511 additions & 0 deletions docs/architecture/statically-typed-region-lifecycle-python.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Contents
installation
getting-started
programming-guide/index
architecture/statically-typed-region-lifecycle-python.md
release-notes
changelog
contributing
Expand Down
16 changes: 16 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,22 @@ check-typing venv="": (install venv)
--ignore deprecated \
src/autobahn/

# pyright --project pyproject-static-typing.toml src/autobahn/wamp/request.py
# mypy --config-file pyproject-static-typing.toml src/autobahn/wamp/request.py
# check-static-typing-subset venv="": (install-tools venv)
check-static-typing-subset venv="":
#!/usr/bin/env bash

echo "=================================================================="
echo " Checking for statically typed Python with pyright:"
echo "------------------------------------------------------------------"
pyright --project pyproject-static-typing.toml src/autobahn/wamp/message.py
echo "=================================================================="
echo " Checking for statically typed Python with mypy:"
echo "------------------------------------------------------------------"
mypy --config-file pyproject-static-typing.toml src/autobahn/wamp/message.py
echo "=================================================================="

# Run coverage for Twisted tests only
check-coverage-twisted venv="" use_nvx="": (install-tools venv) (install-dev venv)
#!/usr/bin/env bash
Expand Down
55 changes: 55 additions & 0 deletions pyproject-static-typing.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
###############################################################################
# Fully statically typed Python => CI job mypy-strict-check
#
# - this is checked via both pyright and mypy
# - ty is sadly not quite yet there (https://docs.astral.sh/ty/reference/typing-faq/#does-ty-have-a-strict-mode)
#
[tool.pyright]
strict = [
# "src/autobahn/wamp/request.py",
# "src/autobahn/wamp/exception.py",
# "src/autobahn/wamp/uri.py",
"src/autobahn/wamp/message.py",
]

[tool.mypy]
mypy_path = "src"

# "strict" is global-only and can't be used in per-module overrides
# https://github.com/python/mypy/issues/11401
strict = false

# some flags are global-only and can't be used in per-module overrides
warn_redundant_casts = true

[[tool.mypy.overrides]]

# this is the "whitelist" of sources/modules which _are_ statically typed:
module = [
# "autobahn.wamp.request",
# "autobahn.wamp.exception",
# "autobahn.wamp.uri",
"autobahn.wamp.message",
]

strict_equality = true
warn_unused_ignores = true # clean up technical debt
warn_return_any = true # don't let functions return Any
warn_unreachable = true # catch dead code from type narrowing
check_untyped_defs = true # type check inside untyped functions
no_implicit_reexport = true
no_implicit_optional = true # no "x: str = None"
disallow_untyped_defs = true # all functions must be typed
disallow_incomplete_defs = true
disallow_untyped_decorators = true
disallow_any_generics = true # no bare list, dict, etc.: List[Any] -> List[str]
disallow_subclassing_any = true # can't subclass untyped imports
disallow_any_unimported = true # Any from missing stubs → error
disallow_any_explicit = true # forbid explicit Any annotations
disallow_any_decorated = true # Any in decorated function signatures

# The Killer Flag for WASM:
disallow_any_expr = true # ANY use of Any-typed expression is an error

#
###############################################################################
Loading