Skip to content

Support custom mypy path #95

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?

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions