<#1752 Pex should support creating a venv directly...
# github-notifications
c
#1752 Pex should support creating a venv directly Issue created by zmanji With the lockfile and venv features it's very easy now to create reproducible venvs with pex. It's very handy for setting up development environments without Docker and you can ensure all of the dependencies are wheels and not sdists. I have been doing this: 1. Create a lock file with
pex3 lock create
. This lockfile contains the resolves for all third party dependencies for all platforms I care about. I can use
--no-build
to ensure all of the dependencies are wheels. 2. With the above lockfile create a dependencies pex with
pex --lock pex.lock --venv -o depencies.pex
3. Create the venv:
PEX_TOOLS=1 ./dependencies.pex venv ./venv
4. Iterate on my first party code by running
PEX_EXTRA_SYS_PATH='./srcs' ./out.pex.venv/pex -m 'mymodule'
. In my case
srcs
contains multiple packages. I install the virtualenv for two reasons: 1. Having a virtualenv allows for tools like PyCharm to pick up all of my dependencies. 2. On my machine, I have observed that executing the pex directly has about 30ms of overhead which is just enough for me to go through with step 3 above. I think pex should be able to collapse steps 2 and 3 above into a single command invocation. I would envision something like:
Copy code
pex3 venv create --lock pex.lock -o venv
pantsbuild/pex