https://pantsbuild.org/ logo
#development
Title
# development
n

nutritious-hair-72580

02/09/2022, 9:06 AM
Asked this before, but what about pytest and its extra_requirements, and mypy and type stubs, etc. As it stands, it seems
./pants export
won’t give you a complete venv - should there be instructions to add those to global requirements.txt?
h

happy-kitchen-89482

02/09/2022, 3:35 PM
So you want a venv that includes all the tools, not just the dependencies of your code?
h

hundreds-father-404

02/09/2022, 3:36 PM
Is this because you are importing the tools directly, like
import pytest
? Or some other reason?
n

nutritious-hair-72580

02/09/2022, 3:41 PM
Yes, in some cases, e.g.
with pytest.raises …
,
@pytest.fixture
, but also for type hinting in the IDE, and to be able to activate a venv in the terminal that has everything we need for the project.
I’ve switched to pycharm recently and found that if I point it to the venv generated by pants, it prompts me to install ’missing packages` for tools, which I have to do if the venv is regenerated, e.g. if we switch versions between branches.
h

hundreds-father-404

02/09/2022, 3:44 PM
What I'm trying to figure out is if https://github.com/pantsbuild/pants/issues/12449 would be sufficient. If the "missing packages" Pycharm complains about are solely due to imports? The effect of #12449 is that certain tools would be / could be included in your user requirements too, while still DRY For example, do you really want us to be installing black in the venv, even though you don't import it? Things become more complicated if so, as the Black tool lockfile needs to be compatible with your own user lockfile(s)
n

nutritious-hair-72580

02/09/2022, 3:59 PM
For black, I guess I could configure pycharm to run
./pants fmt
to format the files, which might be ok.
mypy might be a little different though as I would want the type stubs in the IDE
h

hundreds-father-404

02/09/2022, 4:02 PM
Oh hm, I love PyCharm but am not a power user. I wonder if it would be helpful to have a venv for each tool? That window you're showing suggests to me we could have something like
dist/virtualenvs/black
. Or do you need a single venv with all user requirements + tools?
h

happy-kitchen-89482

02/09/2022, 4:58 PM
I use PyCharm extensively and haven't noticed that issue, let me see
And BTW we are working on "proper" IntelliJ support, which should pretty quickly extend to PyCharm support
pytest
at least should be in the venv if it's a code dependency (i.e., if you
import
it)
type stubs not so much
Let me think about how we could make
export
support those