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

curved-electrician-64177

05/27/2021, 3:12 PM
Trying to generate virtual env for IDE integration (using example-python). I’ve set a version of pytest in pants.toml:
Copy code
[pytest]
version = "pytest==6.2.4"
And I can see correct version (6.2.4) is used during the test:
Copy code
./pants test ::
11:08:01.21 [WARN] The constraints file constraints.txt does not contain entries for the following requirements: pytest
11:08:01.21 [WARN] Ignoring `[python_setup].resolve_all_constraints` option because constraints file does not cover all requirements.
11:08:01.22 [INFO] Completed: test - helloworld/greet/greeting_test.py:tests succeeded.
============================= test session starts ==============================
platform darwin -- Python 3.7.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /private/var/folders/35/0694cnm970qfhkpw87g3xwdw0000gp/T/process-executionSa6d5C
plugins: cov-2.11.1
collected 1 item
But when I try to inspect all dependencies it shows different version (6.2.3, the one I used before):
Copy code
./pants --no-pantsd --tag=-lockfile_ignore dependencies --type=3rdparty ::
ansicolors>=1.0.2
protobuf>=3.11.3
pytest==6.2.3
setuptools<54.0,>=50.3.0
translate>=3.2.1
h

hundreds-father-404

05/27/2021, 4:10 PM
Hello! So this gets into a weird issue with Pants right now. With Pants, we will install Pytest for you because we use it as a tool to run, via the option [pytest].version. But it's also legit for users to use Pytest as a library and import it, which is where you'd put it in requirements.txt For now, the best thing to do is put it in both the option and requirements.txt. Ack that the duplication is unfortunate We are thinking of how to improve this situation with the upcoming redesign of third party requirements
👍 1