I think I know the answer to this, but is there an...
# general
h
I think I know the answer to this, but is there any way to do a
pip install
and point to the pex-based constraints file pants can generate? My context is that I'd really like to switch to the native lockfile generation pants offers, but we still have some tests that rely on a venv-style setup. We currently have
requirements.txt
,
requirements-dev.txt
(which contains things like
pytest
, etc.) and
constraints.txt
generated by
pip-tools
based on those two source files. Pants is happy to use
constraints.txt
even though it contains more information than it actually needs right now. If I generate the lockfile from
generate-lockfiles
, that only reflects
requirements.txt
. I can
./pants export
to get a venv, and then
pip install -r requirements-dev.txt
in that venv, but I'm losing some reproduceability there as that pip install command no longer has a lockfile to look at.
1
h
but I'm losing some reproduceability there as that pip install command no longer has a lockfile to look at.
What do you mean? The Virtual environment will have all pinned versions from your lock file.
h
Only for what was in
requirements.txt
(which doesn't include what is in
requirements-dev.txt
)
h
If I generate the lockfile from generate-lockfiles, that only reflects requirements.txt .
The lockfile will include every
python_requirement
in that resolve, even if your code does not use it. So create a second
python_requirements
target generator
h
Thanks! I'll try that out.
❤️ 1
You were totally right. This makes everything great.
🔥 1
One last thing: Is the venv prompt name configurable?
h
In our current setup, we've typically named our venvs as
<repo name>-venv
so that people have awareness if they're using the wrong venv when switching between repos (since we're not fully monorepo integrated yet)
nbd for right now, just wanted to make sure I didn't miss an option in the docs
h
Main reason this is not configurable is resolves must have their own venvs. We could create a DSL option for people but that's complex