pex icon indicating copy to clipboard operation
pex copied to clipboard

pex3 venv create accepts --bin-path but does not omit __main__.py

Open zmanji opened this issue 1 year ago • 3 comments

pex3 venv create in 2.1.135 accepts a --bin-path argument but does not populate a __main__.py in the root of the venv so it does nothing. To fix this we can remove it from the args list or adjust pex3 venv create to write the __main__.py in the root of the venv.

zmanji avatar May 02 '23 00:05 zmanji

I could document things better, but several of the options don't really make sense unless the venv is built from a --pex-repository (--bin-path and --scope come to mind). What exactly are you trying to do?

jsirois avatar May 02 '23 00:05 jsirois

I could document things better, but none of those options really make sense unless the venv is built from a --pex-repository. What exactly are you trying to do?

It was my understanding the produced __main__.py would add the bin/ directory to the PATH before launching the interpreter or console script as well as set the VIRTUAL_ENV environment variable like the activate script. I was using it as a slightly nicer activate script.

It's not something I really relied on however and I think just following up with a documentation change for the next release would be the right thing to do since it is a slight divergence from running PEX_TOOLS=1 ./my.pex venv -b prepend -f ./venv.

zmanji avatar May 02 '23 01:05 zmanji

Ok, thanks - that helps. Yeah, the idea is a normal venv via requirements or from a --lock is just a normal venv.

jsirois avatar May 02 '23 01:05 jsirois