cool-easter-32542
06/12/2025, 1:54 PM--always-true and --always-false) to test that my source code typechecks correctly across feature flag configurations. Currently I do this by repeatedly running pants check with different values for --mypy-args.
Describe the solution you'd like
I would like to be able to do this using parametrize and a single invocation of pants check, and maintain mypy "incremental mode" performance levels. I'm unsure where exactly to use 'parametrize', if it would be on all python source files (using __defaults__), or maybe only on an entrypoint or on the config file that loads the feature flags (where it would affect everything by dependency inference.
Describe alternatives you've considered
As mentioned above, repeated usages of pants check. The downside of this is that it breaks mypy internal caching and causes the check run to take much longer.
Before using pants, I solved this with repeated calls to mypy, using distinct caches (see https://mypy.readthedocs.io/en/stable/command_line.html#incremental-mode).
This allowed each configuration to use a separate cache, and maintain performance, but I'm not sure how this would map to pants check since my understanding is that pants manipulates/controls the mypy cache arguments to coordinate them with pants' own cache.
I would be interested in working on this myself, but would need some guidance since this is deep in the weeds of the mypy subsystem. Either way, its best to start with a high level discussion.
pantsbuild/pants