Project: use list of paths instead of pyright_cmd
#135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for creating
mypy_primer
! As of recently, we use it to run test Red Knot against (a small subset of) ecosystem projects. So far, we use a fork ofmypy_primer
, but I would like to clean up our implementation, add some improvements, and potentially upstream some of the changes — if you are interested.As a first step, I would like to propose a change to the
Project
dataclass. So far, it stores a custommypy_cmd
and apyright_cmd
. I've noticed that thepyright_cmd
in particular only comes in three variants:pyright_cmd=None
— which means that Pyright shouldn't run for this projectpyright_cmd="{pyright}"
— which means that Pyright should be executed without passing any explicit pathspyright_cmd="{pyright} some relative paths"
— which means that the command line includes a list of explicit paths that are passed to Pyright.In particular, there are no
pyright_cmd
fields that pass additional flags to pyright.For running other type checkers, it would be beneficial to have that information in a more structured form. This way we could reuse the list of explicit paths. So I'm proposing the following change:
pyright_cmd=None
, we add a new flagpyright_skip=True
.pyright_cmd="{pyright}"
, we simply remove thatpyright_cmd
parameter. We consider that to be the new default.pyright_cmd="{pyright} some relative paths"
, we also remove thepyright_cmd
parameter and add a newpaths=["some", "relative", "paths"]
field.I have not attempted to change the representation for mypy, but I could do so if it seems desirable. I'd like to discuss the general approach first.
I tested this by running