I have a few questions that have come up after a w...
# general
a
I have a few questions that have come up after a week of getting to know Pants: • The virtual environment created by
./pants export::
does not include pytest. Because of that PyCharm's builtin test support won't work. I can add pytest to the list of 3rd party dependencies, but I am not sure this is how it's intended? I also get venv's for each tool, but those miss my regular dependencies. • The generated lockfile (based on
requirements.txt
) only pins version of the listed packages. If I want to lock the version of any downstream dependencies, should I instead use Pipenv or Poetry?
(not true) In any case, I appreciate the speedy help that I have gotten here and the thorough documentation available 👍
👀 1
c
Hi Carl, I’ll take an initial stab at some partial answers/questions for you bullets there:
• The virtual environment created by
./pants export::
does not include pytest. Because of that PyCharm’s builtin test support won’t work. I can add pytest to the list of 3rd party dependencies, but I am not sure this is how it’s intended? I also get venv’s for each tool, but those miss my regular dependencies.
The
export
goal will only include libs present in the “resolve” (fancy word for a lockfile) — if there’s no pytest in the lockfile it won’t be present in the exported venv either. If you need pytest in there, it’s fine to add it to your requirements.txt, you don’t need to worry it will end up in your production code as if you don’t have production code depending on pytest, it won’t be included there. Regarding the tool venvs, same thing applies here, each tool have their own resolve (lockfile) unrelated to your projects resolves by design (otherwise there may be conflicts and what not). What was your expectations for seeing your regular dependencies in the tools venv?
• The generated lockfile (based on
requirements.txt
) only pins version of the listed packages. If I want to lock the version of any downstream dependencies, should I instead use Pipenv or Poetry?
This sounds wrong. Could you provide more details? In my experience this works as intended, that the lockfile includes all transitive dependencies in the lockfile, not only those provided from the input requirements.txt
a
I'll retract that 2nd statement. I wasn't looking close enough 🤦 Regarding the first, I am use to working with Pipenv where you have a separate section for the dev-dependencies. But I'll just add pytest as a dependency and all should be good! 🙂 Thanks for your help!
👍 1
h
Yeah, we should call this out more clearly in the docs. But unlike other tools, where the requirements are always all used, and so you manually divide them up into dev and runtime deps, Pants treats all the requirements in a resolve as a "universe" from which to select the actual requirements used (based on inferred and explicit deps).
c
yea, it’s a killer feature to be proud of!
b
Definitely worth clarifying this in the docs.