How am I supposed to get the old behaviour of `myp...
# general
a
How am I supposed to get the old behaviour of
mypy.extra_type_stubs
? I have them in the requirements, and they seem to be installed (though, since the output is truncated, can't be 100% sure), but it doesn't seem to be working. I feel I'm missing something stupid here...
t
I'm new to pants but perhaps my solution will work for you as well.
Copy code
g py $ tree 3rdparty/
3rdparty/
└── python
    ├── BUILD
    ├── default.lock
    ├── mypy.lock
    ├── mypy-requirements.txt
My mypy-requirements.txt file contains the following:
Copy code
mypy~=1.9.0
sqlalchemy[mypy]==1.4.41
...
I have a requirements.txt file that contains the sqlalchemy dependency as well:
Copy code
sqlalchemy[asyncio]~=1.4.41
...
which is used to generate the default.lock lockfile. Basically I had to include the requirement in both mypy-requirements.txt and requirements.txt.
a
I mean, that's on the right path, I think. I would have to manually add it as a dep to targets, though, which I don't want. The problem seems to be that when it runs mypy, it uses a
--python-executable
that points to the virtual env created for the actual code it's testing, not the one mypy is running in (i.e. the one with all the stubs).
Though, hm, that won't work, since now it won't have all the other typing info, from 3rd party packages.
But, yeah, I don't understand how this could work. I need to go back to our 2.17 branch to see how this worked there, I imagine the venv that was used had both mypy and normal code 3rd party deps.
Hm, I see, in 2.17, with
extra_type_stubs
, the
requirements_venv.pex
had both. In 2.20, it doesn't have the mypy stuff.