I’m confused about resolve management for things l...
# general
f
I’m confused about resolve management for things like mypy plugins. Concretely, I want to configure mypy so that it can use pydantic.mypy. Is there a reason why I wouldn’t want to add mypy into my requirements.txt and use my python-default resolve as the resolve for mypy? The docs imply creating a separate mypy.lock: https://www.pantsbuild.org/stable/docs/python/goals/check#change-the-mypy-version
e
I think the most change-proof way to do things is to have these tools use their own lock. This would for example prevent you from accidentally importing something from mypy (is that even possible?) or from pytest (definitely possible) in your production code by mistake. That said, my team just uses a "universal resolve" style, where everything is in the resolve and then I use
install_from_resolve
and
requirements
in my
pants.toml
to use the mypy version in the big resolve. I also set the
config
variable to point to a
pyproject.toml
file and have settings for
tool.pydantic-mypy
and it seems to be working correctly.
Off the top of my head, I don't think I had to explicitly configure the plugin anywhere, as long as pydantic and mypy were installed in the same resolve
h
You don’t have to use a separate lockfile, you absolutely can use your python-default. One downside is that any change to python-default invalidates all your typechecking, even if the version of mypy didn’t change. But that is probably want you want in practice anyway…