Skip to content

Switch to unconditional invocation of "get-pip.py" #194

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

Merged
merged 1 commit into from
May 1, 2017

Conversation

tianon
Copy link
Member

@tianon tianon commented Apr 28, 2017

Combining --without-ensurepip / Include_pip=0 and get-pip.py, we can move the pip installation to an entirely separate layer, thus allowing for pip-only bumps to build faster, given that Python will not also need to be recompiled. This also insulates us from having to decide how often to bump setuptools (which has a fairly aggressive release cycle) -- it will naturally bump to the latest version at every pip release, every Python release, or every base-image-triggered rebuild.

See also #186, especially #186 (comment).

Thanks to @mal for bringing the issue up originally (and suggesting pretty much this exact fix in a slightly different form 😇), @JayH5 for pointing out how aggressive the setuptools release cycle is, and @dstufft for being generally awesome, doing good work, and on top of all that being willing to help point us in sane directions when we're going crazy. ❤️ ❤️

2.7/Dockerfile Outdated
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' +; \
rm -rf /tmp/get-pip.py ~/.cache
Copy link

Choose a reason for hiding this comment

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

You might just prefer adding --no-cache-dir to your get-pip.py call, that should tell pip not to use the cache at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oooh, that sounds awesome 😄 -- does that mean that the "install python" layer might not need to purge ~/.cache anymore either, now that it doesn't do anything pip-related?

Copy link

Choose a reason for hiding this comment

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

Probably? Not sure if anything else in the Python build process writes to ~/.cache.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, it is the case 🤘 (just tested) -- so the only file leftover is ~/.cache/pip/selfcheck.json, which I got rid of by also adding --disable-pip-version-check! 🎈

I'll update the PR shortly. 👍 ❤️ ❤️ ❤️

Combining `--without-ensurepip` / `Include_pip=0` and `get-pip.py`, we can move the `pip` installation to an entirely separate layer, thus allowing for `pip`-only bumps to build faster, given that Python will not also need to be recompiled.  This also insulates us from having to decide how often to bump `setuptools` (which has a fairly aggressive release cycle) -- it will naturally bump to the latest version at every `pip` release, every Python release, or every base-image-triggered rebuild.
Copy link
Contributor

@JayH5 JayH5 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @tianon for your enthusiasm in figuring this stuff out 😄.

\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
apk del .fetch-deps; \
Copy link
Contributor

Choose a reason for hiding this comment

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

This spacing between the lines seems maybe a bit excessive..but nbd.

Also not sure about mixing the styles:

RUN set -x \
  && foo \
...

with

RUN set -ex; \
  foo; \
...

but that's really up to you.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's a bit odd, but it does help with the cross-variant diffs (doing vimdiff across all the different variants in this repo gets pretty tedious, so any little bit helps). 😇 👍

Switching to semicolons is something I thought about doing to the whole file, but decided to keep the change smaller for now. We've been trying to switch most things over to semicolons (slowly), especially after having fun with things like foo && for xxx; do something-that-might-fail; done && bar, which creates a "complex expression", and thus the rules for failure change (such that the for xxx; do ...; done bit of that expression will only fail if the final iteration fails, for example).

From https://www.gnu.org/software/bash/manual/bashref.html#index-set:

The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return status is being inverted with !.

Thanks for taking a look 😄

@yosifkit yosifkit merged commit c3ff1c2 into docker-library:master May 1, 2017
@yosifkit yosifkit deleted the get-pip.py branch May 1, 2017 17:49
tianon added a commit to infosiftr/stackbrew that referenced this pull request May 1, 2017
- `mongo`: 3.2.13
- `python`: unconditionally invoke `get-pip.py` to install `pip` more consistently (docker-library/python#194)
- `ruby`: rubygems 2.6.12
JayH5 added a commit to praekeltfoundation/docker-alpine-python that referenced this pull request May 3, 2017
tao12345666333 pushed a commit to tao12345666333/python that referenced this pull request Jun 28, 2018
Switch to unconditional invocation of "get-pip.py"
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

4 participants