Just started using Pants. Loving it so far... but ...
# general
q
Just started using Pants. Loving it so far... but I've hit a snag trying to integrate it with my IDE (VS Code). I'm exporting resolves to venvs as part of this (following https://www.pantsbuild.org/v2.16/docs/setting-up-an-ide#python-third-party-dependencies-and-tools), but I need to be able to export multiple resolves to the same venv... is this possible? Any help much appreciated! 🙏
a
It would definitely be impossible if your resolves require different versions of the same package. Is this the case? I'm not sure it would work either way, but someone more well-versed in Pants than me would have to chime in then!
f
if I got it right you need to 'properly' setup the resolve for your app - with all requirements included. this could then be exported to a venv and consumed by code. debugging tests works differently, you'll attach to a remote debugger from code's perspective. (manual process until vscode extension might help here) running the app (also in debug mode) stays the same. formatting and linting could be installed into code independently from pants and used (until vscode extension might help here)
h
Multiple resolves to the same venv is not generally possible - this impossibility is why multiple resolves exist! It is possible only if all the resolves are mutually compatible, in which case why have multiple resolves in the first place...?
👍 1
q
Thanks for the responses! I don't have different versions of packages for different resolves, so no conflict there. I should have specified the use-case (which doesn't seem like it would be uncommon, so I must be thinking about things the wrong way): I want a resolve for packages that are used in production deployment, a resolve for testing and static analysis, and a resolve for development (including things like jupyter and plotly). VS Code would use all three. Something like GitHub Actions would use the first and second. And production only the first). How best to achieve this? Hmm, if I just lump them all in together, I think Pants will only use the required ones when producing a deployable artifact?
h
Yep, exactly! We're so used to Python consuming an entire requirements.txt always, that it is a non-intuitive feature of Pants that it doesn't do so. A resolve is a universe of possible deps and their transitive deps, and you only actually depend on the subset you need.
So if you have no conflicts, you probably want a single resolve
🙏 1