Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add venv --remove {pex,all} option. #1525

Merged
merged 3 commits into from
Nov 27, 2021
Merged

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Nov 27, 2021

This is especially useful for installing a PEX in a container image.

This is especially useful for installing a PEX in a container image.
@jsirois
Copy link
Member Author

jsirois commented Nov 27, 2021

For example:

$ python -mpex --python python3.10 --include-tools isort==5.10.1 -c isort -o /tmp/isort/isort.pex
$ cat <<EOF > /tmp/isort/Dockerfile
FROM python:3.10-slim
COPY isort.pex /isort.pex
RUN PEX_TOOLS=1 /isort.pex venv --rm all --compile /isort
ENTRYPOINT ["/isort/pex"]
EOF
$ docker build -t isort:5.10.1 /tmp/isort
Sending build context to Docker daemon   1.11MB
Step 1/4 : FROM python:3.10-slim
 ---> 650d66a00131
Step 2/4 : COPY isort.pex /isort.pex
 ---> Using cache
 ---> 3bfe59e08b0d
Step 3/4 : RUN PEX_TOOLS=1 /isort.pex venv --rm all --compile /isort
 ---> Using cache
 ---> a962a843c02a
Step 4/4 : ENTRYPOINT ["/isort/pex"]
 ---> Using cache
 ---> 7daaef265cf9
Successfully built 7daaef265cf9
Successfully tagged isort:5.10.1
$ time docker run --rm isort:5.10.1 --version

                 _                 _
                (_) ___  ___  _ __| |_
                | |/ _/ / _ \/ '__  _/
                | |\__ \/\_\/| |  | |_
                |_|\___/\___/\_/   \_/

      isort your imports, so you don't have to.

                    VERSION 5.10.1


real	0m0.467s
user	0m0.011s
sys	0m0.020s

Copy link
Collaborator

@kaos kaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool :)

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@jsirois jsirois merged commit 802ecc7 into pex-tool:main Nov 27, 2021
@jsirois jsirois deleted the venv/remove branch November 27, 2021 20:23
@jsirois jsirois mentioned this pull request Dec 14, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants