Hello all - curious about hot to get type checkers...
# ask-metaflow
c
Hello all - curious about hot to get type checkers (mypy, pyright) to get Parameters recognized correctly? if I do
Copy code
instructions = Parameter(name="instructions",type=str)
And later I have a function expecting a string and try to use
instructions
to pass to it, pyright says:
Copy code
Argument of type "Parameter" cannot be assigned to parameter "param" of type "str" in function "myfunc"
👀 1
s
@dry-beach-38304 any thoughts here?
c
Just another ping here in case it got lost!
d
oh it did get lost. We may be able to work something out with a generic type but I can’t figure the last bit which is actually making them fully behave like int/str/etc. There seems to be some way with protocols (not 100% sure) but that’s 3.8+ (and we try to support 3.6 at least). I’ll give it a bit more thought.
🙌 1
c
Yeah we just either use
cast(str, instructions)
or "convert" directly when passing like
str(instructions)
which is fine for now - just wanted to make sure I wasn't missing something - thanks!
d
cast or str will work but it would be nicer to have something better for sure.