Is it possible to run multiple python versions of ...
# general
g
Is it possible to run multiple python versions of pants targets at a time? I'd like to simulate (or even just directly use) tox and run pytest in multiple versions of python to ensure compatibility. Maybe other targets as it makes sense.
h
It is! Via `parametrize()`: https://blog.pantsbuild.org/introducing-pants-2-11/ You'll want to set that on your
python_tests
targets, like this:
Copy code
python_tests(
  name="tests",
  interpreter_constraints=parametrize(
     py37=["==3.7.*"],
     py38=["==3.8.*"],
  ),
)
You can use a macro if it's getting tedious to type that. https://www.pantsbuild.org/docs/macros
fyi some feedback we've gotten from people is it's too hard to say "Run all the tests in my repo, but only the Py37 versions" otherwise, seems to have worked out well
g
Ok, that is a fair point.
Maybe I'll avoid this for now.
Now I just need to figure out how to properly configure bandit (a problem I always face outside of using pants).
b
Sounds like something to open a feature request about...