Hey all, I've got a peculiar issue with Pants and ...
# general
d
Hey all, I've got a peculiar issue with Pants and MyPy. I have a situation where I am running
pants check ::
on files that I know have wrong imports, however check comes back saying there are no issues. However, If i use mypy instead, it reports errors. I cannot seem to figure out how the configuration is different when running mypy through Pants 😕 Here are the relavant
pants.toml
sections
Copy code
[GLOBAL]
pants_version = "2.21.0"
colors=true
backend_packages = [
    "pants.backend.docker",
    "pants.backend.python",
    "pants.backend.shell",
    "pants.backend.python.typecheck.mypy",
    "pants.backend.experimental.python.lint.ruff.format",
    "pants.backend.experimental.python.lint.ruff.check",
    "pants.backend.experimental.python",
    "pants.backend.python.lint.isort"
]

[source]
root_patterns = ["src", "tests"]

[python]
pip_version = "24.0"
interpreter_constraints = [">=3.10,<3.11"]
enable_resolves = true

[python-infer]
use_rust_parser = true
and
pyproject.toml
Copy code
[tool.mypy]
<#C01CQHVDMMW|> = []
strict = true
implicit_reexport = true
disallow_untyped_decorators = false

[[tool.mypy.overrides]]
module = [
    "faceoff_backend.*",
    "boto3.*",
    "botocore.*",
    "ddtrace",
    "fsspec.*",
    "PyOpenColorIO.*",
    "ffmpeg.*",
    "opentimelineio.*",
    "Imath.*",
    "OpenEXR.*",
    "sortedcontainers.*",
    "requests.*"
]
ignore_missing_imports = true
ignore_errors = false
h
Hi, a small repo that reproduces this would be useful. There are various moving parts that may be relevant.
d
Hi @happy-kitchen-89482 playing a little more with the mypy settings in pants.toml, setting the
config_discovery = false
does result in the behaviour I expect, but introduces other errors that are sorted by using the overrides in pyproject.toml 🙂
I'll try creating a minimal example
f
overrides in pyproject.toml
what mypy-related overrides can you do in pyproject.toml?
s