Skip to content

Support custom mypy path #95

@achimnol

Description

@achimnol

In a monorepo setting using Pantsbuild, various Python tools are installed in separate virtaulenvs like:

  • dist/export/python/virtualenvs/mypy/3.12.6/bin/mypy
  • dist/export/python/virtualenvs/ruff/3.12.6/bin/ruff

while the main source tree looks at (while it is also possible to have per-subdir lock files):

  • dist/export/python/virtualenvs/python-default/3.12.6/bin/python

I can override the --python-executable argument passed to mypy for the main virtualenv, but I cannot override the mypy executable path itself.
It seems to be hardcoded here:

if shutil.which("mypy"):
# mypy exists on path
# -> use mypy on path
log.info("executing mypy args = %s on path", args)
completed_process = subprocess.run(
["mypy", *args], capture_output=True, **windows_flag, encoding="utf-8"
)

Could we make it something configurable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions