https://pantsbuild.org/ logo
#general
Title
# general
r

rapid-crayon-8232

03/17/2022, 9:21 AM
Hey 👋 , I have a question about probably an edge case, if you have
pytest
as a dependency in your
requirements.txt
and you import
pytest
in your test files or
conftest.py
so it is discovered by dependency inference, what pytest distribution is used for the tests ? the global defined in
pants.toml
or the one in the user defined lock file ? I know It's confusing adding
pytest
as a dependency, but the main use case is for IDE support, ie: when running
./pants export //:poetry
, I'd like to have
black
,
isort
,
pytest
, ... exported too
h

happy-kitchen-89482

03/17/2022, 4:18 PM
It will use the version in requirements.txt I believe
@hundreds-father-404 can confirm
the version in pants.toml is for "pytest as a tool that pants invokes", the version in requirements.txt is for "pytest as a dependency"
It would be good to be able to sync those two automatically, I think there's a todo for that
r

rapid-crayon-8232

03/17/2022, 4:20 PM
ex: in a
python_test
use pytest as a tool in a
python_source
use pytest as a dep ?
h

hundreds-father-404

03/17/2022, 4:21 PM
https://github.com/pantsbuild/pants/issues/12449. Not at all weird, it makes sense to do this - it's a shame Pants does not support this better
It will use the version in requirements.txt I believe
It will install Pytest twice (bleh), then I can't quite remember how Pex handles merging the two PEXes when there's the same dep. I want to say it goes with the first one encountered..
h

happy-kitchen-89482

03/17/2022, 4:30 PM
@rapid-crayon-8232 can you open a ticket for the exporting-a-tool-for-use-by-IDE case? cc @acoustic-librarian-3937
👍 2
r

rapid-crayon-8232

03/17/2022, 4:42 PM
3 Views