faust icon indicating copy to clipboard operation
faust copied to clipboard

How do I get mypy to work with subtypes of Record

Open tarbaig opened this issue 4 years ago • 0 comments

mypy fails to notice type mismatches in subclasses of faust.Record. However, the documentation explicitly mentions static typing and type checking and when going through the codebase, great care has been taken to annotate and cast.

Steps To Reproduce

define record_test.py

from faust import Record

class Point(Record):
    x : int
    y : int

def fun() -> None:
    Point(x = "a",y="b")

run

mypy --strict record_test.py

Observed behavior

mypy --strict record_test.py 
Success: no issues found in 1 source fil

Expected

I would expect mypy to report an error since a string is assigned to an int field.

Versions

  • Python version 3.9
  • Faust version
pip show faust-streaming
Name: faust-streaming
Version: 0.7.0
mypy --version
mypy 0.910

tarbaig avatar Dec 04 '21 22:12 tarbaig