Is there a way to parametrize a mypy run? I have a...
# general
e
Is there a way to parametrize a mypy run? I have a case where I'd like to run mypy twice against some files: like
mypy ./directory --always-true MY_EXPRESSION
and then `mypy ./directory --always-false MY_EXPRESSION`so that I can typecheck against two variations of some definitions (you can think of it a bit like an
#ifdef/else
macro in C). I see that I can define
--mypy-args
in the
pants.toml
file, but I can't use parametrize there. (Plus this would make it run against all files, instead of just some specific targets). However, in the
BUILD
files, where I can specify particular targets, and use parametrize, it looks like
python_source(s)
only give me options to skip mypy, but not to configure it with any specific args. Is there a way to achieve something like this? My last resort is to just settle for a wrapper script that calls
pants check <args>
twice, but I think that will have much worse reporting than something that was built in to a single
pants
invocation
b
Ah interesting. It does seem like that Pants may not natively support that yet, so a wrapper script may be all you have. Is it something you'd be interested in contributing?
e
I am still new to pants, but if I can see a good way to do it, I could look into it