Skip to content

Support invoking mypy from setuptools (feature request) #5611

Closed
@eric-wieser

Description

@eric-wieser

It would be great if mypy (or some external tool, mypy-setuptools or something) could provide an easy way to run mypy against just the files in a distribution.

There was some work done on this in #994 (to close #992) by @rowillia, but it was reverted without comment in 964a175 by @JukkaL.

Given the python-3.6+ dependence of mypy, and the fact it can check older python versions, I think it would make sense for this setuptools plugin to ultimately just invoke subprocess.check_call(['mypy', ...]), which would allow it to be used on python2 projects too. For this reason, it would make sense for it not to live in the mypy repo, as it would need to be installable within python instances where mypy is not.

One difficulty here is how exactly to test only the files in a distribution. Some options are:

  • Running against the source - this doesn't respect the package_dir argument in setuptools.
  • Collecting distribution.modules and distribution.packages - this will end up checking the full contents of any namespace package partially provided by this distribution
  • Inspecting an egg or wheel somehow, and letting mypy take one of these as an argument?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions