cool-easter-32542
04/27/2023, 12:34 PM-D DIR option adds directory entries in DIR at the root of the Pex import namespace.
This is awkward given a typical workspace layout like
.github/workflows/...
pyproject.toml
README.md
.venv/...
myapp/__init__.py
as giving -D . includes lots of junk that is also in the workspace (up to and including whole virtualenvs) and giving -D myapp does not create a myapp package in the Pex, it puts __init__.py into the root instead.
A workspace layout with a src/ directory works but it means that a plain python command cannot import myapp.
I would propose adding an option (say -P) to include a single Python package or module in the PEX.
With this option:
• -P myapp would copy the myapp package into the PEX and make it importable as myapp
• -P myapp.py would copy the myapp.py module into the PEX and make it importable as myapp
pantsbuild/pex