Skip to content

Commit 36a91ef

Browse files
committed
Update pipenv to 2020.11.15 and unpin pip
Previously the buildpack used pipenv `2018.5.18`, which didn't support newer pip, meaning that apps using pipenv had to be pinned to a much older version of pip. For apps using pipenv, the buildpack now installs pipenv `2020.11.15` and no longer overrides the pip version compared to non-pipenv installs, meaning pip `20.1.1` is now used instead of pip `9.0.2`. Changes: https://github.com/pypa/pipenv/blob/master/CHANGELOG.rst#20201115-2020-11-15 pypa/pipenv@v2018.05.18...v2020.11.15 This is particularly important since the recently released `cryptography` v3.4 requires at least pip 19.x, otherwise pip is unable to use its newer style wheels, and so falls back to building the source distribution. This causes the install to fail, since building `cryptography` now requires Rust, which is not present in the Heroku stack image. Fixes #979. Fixes #987. Fixes #1108. Closes GUS-W-8054805.
1 parent 79086ba commit 36a91ef

File tree

4 files changed

+33
-40
lines changed

4 files changed

+33
-40
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Update pipenv from `2018.5.18` to `2020.11.15` ([#1169](https://github.com/heroku/heroku-buildpack-python/pull/1169)).
6+
- Remove pinning of pip to `9.0.2` when using pipenv ([#1169](https://github.com/heroku/heroku-buildpack-python/pull/1169)).
57

68
## v188 (2020-12-21)
79

bin/steps/pipenv

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,30 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
4949
mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE"
5050
fi
5151

52-
export PIPENV_VERSION="2018.5.18"
52+
PIPENV_VERSION='2020.11.15'
5353

5454
# Install pipenv.
5555
# Due to weird old pip behavior and pipenv behavior, pipenv upgrades pip
5656
# to latest if only --upgrade is specified. Specify upgrade strategy to
5757
# avoid this eager behavior.
58-
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
58+
/app/.heroku/python/bin/pip install "pipenv==${PIPENV_VERSION}" --upgrade --upgrade-strategy only-if-needed &> /dev/null
5959

6060
# Install the test dependencies, for CI.
6161
if [ "$INSTALL_TEST" ]; then
62-
puts-step "Installing test dependencies"
62+
puts-step "Installing test dependencies"
6363
/app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
6464

6565
# Install the dependencies.
6666
elif [[ ! -f Pipfile.lock ]]; then
67-
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION"
67+
puts-step "Installing dependencies with Pipenv ${PIPENV_VERSION}"
6868
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
6969

7070
else
7171
pipenv-to-pip Pipfile.lock > requirements.txt
7272
cp requirements.txt .heroku/python/requirements-declared.txt
7373
openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
7474

75-
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION"
75+
puts-step "Installing dependencies with Pipenv ${PIPENV_VERSION}"
7676
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
7777
fi
7878
fi

bin/steps/python

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ elif [[ "${PYTHON_VERSION}" == ${PY27}* || "${PYTHON_VERSION}" == ${PYPY27}* ]];
158158
SETUPTOOLS_VERSION='44.1.1'
159159
fi
160160

161+
puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and wheel ${WHEEL_VERSION}"
162+
161163
# We don't use get-pip.py, since:
162164
# - it uses `--force-reinstall`, which is unnecessary here and slows down repeat builds
163165
# - it means downloading pip twice (once embedded in get-pip.py, and again during
@@ -175,19 +177,7 @@ if ! curl -sSf "${PIP_WHEEL_URL}" -o "$PIP_WHEEL"; then
175177
exit 1
176178
fi
177179

178-
if [[ -f "$BUILD_DIR/Pipfile" ]]; then
179-
# The buildpack is pinned to old pipenv, which requires older pip.
180-
# Pip 9.0.2 doesn't support installing itself from a wheel, so we have to use split
181-
# versions here (ie: installer pip version different from target pip version).
182-
PIP_VERSION='9.0.2'
183-
PIP_TO_INSTALL="pip==${PIP_VERSION}"
184-
else
185-
PIP_TO_INSTALL="${PIP_WHEEL}"
186-
fi
187-
188-
puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and wheel ${WHEEL_VERSION}"
189-
190180
/app/.heroku/python/bin/python "${PIP_WHEEL}/pip" install --quiet --disable-pip-version-check --no-cache \
191-
"${PIP_TO_INSTALL}" "setuptools==${SETUPTOOLS_VERSION}" "wheel==${WHEEL_VERSION}"
181+
"${PIP_WHEEL}" "setuptools==${SETUPTOOLS_VERSION}" "wheel==${WHEEL_VERSION}"
192182

193183
hash -r

spec/hatchet/pipenv_spec.rb

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
remote: -----> Python app detected
1111
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
1212
remote: -----> Installing python-#{python_version}
13-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
14-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
15-
remote: Installing dependencies from Pipfile.lock \\(.*\\)
13+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
14+
remote: -----> Installing dependencies with Pipenv 2020.11.15
15+
remote: Installing dependencies from Pipfile.lock \\(.*\\)...
1616
remote: -----> Installing SQLite3
1717
REGEX
1818
end
@@ -30,9 +30,9 @@
3030
remote: ! No 'Pipfile.lock' found! We recommend you commit this into your repository.
3131
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
3232
remote: -----> Installing python-#{DEFAULT_PYTHON_VERSION}
33-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
34-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
35-
remote: Installing dependencies from Pipfile
33+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
34+
remote: -----> Installing dependencies with Pipenv 2020.11.15
35+
remote: Installing dependencies from Pipfile...
3636
remote: -----> Installing SQLite3
3737
REGEX
3838
end
@@ -48,9 +48,9 @@
4848
remote: -----> Python app detected
4949
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
5050
remote: -----> Installing python-#{DEFAULT_PYTHON_VERSION}
51-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
52-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
53-
remote: Installing dependencies from Pipfile.lock \\(aad8b1\\)
51+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
52+
remote: -----> Installing dependencies with Pipenv 2020.11.15
53+
remote: Installing dependencies from Pipfile.lock \\(aad8b1\\)...
5454
remote: -----> Installing SQLite3
5555
REGEX
5656
end
@@ -70,9 +70,9 @@
7070
remote: Learn More: https://devcenter.heroku.com/articles/python-2-7-eol-faq
7171
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
7272
remote: -----> Installing python-#{LATEST_PYTHON_2_7}
73-
remote: -----> Installing pip 9.0.2, setuptools 44.1.1 and wheel 0.34.2
74-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
75-
remote: Installing dependencies from Pipfile.lock \\(b8efa9\\)
73+
remote: -----> Installing pip 20.1.1, setuptools 44.1.1 and wheel 0.34.2
74+
remote: -----> Installing dependencies with Pipenv 2020.11.15
75+
remote: Installing dependencies from Pipfile.lock \\(b8efa9\\)...
7676
remote: -----> Installing SQLite3
7777
REGEX
7878
end
@@ -172,9 +172,9 @@
172172
remote: -----> Python app detected
173173
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
174174
remote: -----> Installing python-#{LATEST_PYTHON_3_9}
175-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
176-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
177-
remote: Installing dependencies from Pipfile.lock \\(75eae0\\)
175+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
176+
remote: -----> Installing dependencies with Pipenv 2020.11.15
177+
remote: Installing dependencies from Pipfile.lock \\(75eae0\\)...
178178
remote: -----> Installing SQLite3
179179
REGEX
180180
end
@@ -189,9 +189,9 @@
189189
expect(clean_output(app.output)).to include(<<~OUTPUT)
190190
remote: -----> Python app detected
191191
remote: -----> Installing python-#{LATEST_PYTHON_3_9}
192-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
193-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
194-
remote: Installing dependencies from Pipfile.lock (ef68d1)
192+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
193+
remote: -----> Installing dependencies with Pipenv 2020.11.15
194+
remote: Installing dependencies from Pipfile.lock (ef68d1)...
195195
remote: -----> Installing SQLite3
196196
OUTPUT
197197
end
@@ -203,14 +203,15 @@
203203

204204
it 'fails the build' do
205205
app.deploy do |app|
206-
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
206+
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
207207
remote: -----> Python app detected
208208
remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory
209209
remote: -----> Installing python-#{DEFAULT_PYTHON_VERSION}
210-
remote: -----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
211-
remote: -----> Installing dependencies with Pipenv 2018.5.18…
210+
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
211+
remote: -----> Installing dependencies with Pipenv 2020.11.15
212212
remote: Your Pipfile.lock \\(aad8b1\\) is out of date. Expected: \\(ef68d1\\).
213-
remote: Aborting deploy.
213+
remote: \\[DeployException\\]: .*
214+
remote: ERROR:: Aborting deploy
214215
REGEX
215216
end
216217
end

0 commit comments

Comments
 (0)