Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Deprecated support for Python 3.10. ([#1972](https://github.com/heroku/heroku-buildpack-python/pull/1972))
- Updated uv from 0.9.9 to 0.9.11. ([#1973](https://github.com/heroku/heroku-buildpack-python/pull/1973))
- Switched from using `--disable-pip-version-check` to the env var `PIP_DISABLE_PIP_VERSION_CHECK=1` when using pip. ([#1974](https://github.com/heroku/heroku-buildpack-python/pull/1974))

## [v320] - 2025-11-20

Expand Down
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ python::install "${BUILD_DIR}" "${STACK}" "${python_full_version}" "${python_maj
package_manager_install_start_time=$(build_data::current_unix_realtime)
case "${package_manager}" in
pip)
pip::install_pip "${python_home}" "${python_major_version}"
pip::install_pip "${python_home}" "${python_major_version}" "${EXPORT_PATH}" "${PROFILE_PATH}"
;;
pipenv)
pipenv::install_pipenv "${python_home}" "${python_major_version}" "${EXPORT_PATH}" "${PROFILE_PATH}"
Expand Down
18 changes: 16 additions & 2 deletions lib/pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ WHEEL_VERSION=$(utils::get_requirement_version 'wheel')
function pip::install_pip() {
local python_home="${1}"
local python_major_version="${2}"
local export_file="${3}"
local profile_d_file="${4}"

build_data::set_string "pip_version" "${PIP_VERSION}"

Expand Down Expand Up @@ -74,6 +76,20 @@ function pip::install_pip() {
build_data::set_string "failure_reason" "install-package-manager::pip"
exit 1
fi

# Saves us having to pass `--disable-pip-version-check` each time pip is used. Note: We can't use
# this for the pip install usage above, since `--isolated` disables reading of `PIP_` env vars.
export PIP_DISABLE_PIP_VERSION_CHECK="1"

# Set the same env vars in the environment used by later buildpacks.
cat >>"${export_file}" <<-EOF
export PIP_DISABLE_PIP_VERSION_CHECK="1"
EOF

# And the environment used at app run-time.
cat >>"${profile_d_file}" <<-EOF
export PIP_DISABLE_PIP_VERSION_CHECK="1"
EOF
}

function pip::install_dependencies() {
Expand Down Expand Up @@ -112,7 +128,6 @@ function pip::install_dependencies() {
local install_log
install_log=$(mktemp)

# TODO: Remove --disable-pip-version-check in favour of exporting PIP_DISABLE_PIP_VERSION_CHECK.
# The sed usage is to reduce the verbosity of output lines like:
# ...when using Python 3.10 and older:
# "Requirement already satisfied: typing-extensions==4.12.2 in ./.heroku/python/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (4.12.2)"
Expand All @@ -121,7 +136,6 @@ function pip::install_dependencies() {
# shellcheck disable=SC2310 # This function is invoked in an 'if' condition so set -e will be disabled.
if ! {
"${pip_install_command[@]}" \
--disable-pip-version-check \
--exists-action=w \
--no-cache-dir \
--no-input \
Expand Down
5 changes: 2 additions & 3 deletions spec/fixtures/pip_basic/bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ echo
python -c 'import pprint, sys; pprint.pp(sys.path)'
echo

# TODO: Remove --disable-pip-version-check in favour of exporting PIP_DISABLE_PIP_VERSION_CHECK
pip --version --disable-pip-version-check
pip list --disable-pip-version-check
pip --version
pip list
echo

python -c 'import typing_extensions; print(typing_extensions)'
Expand Down
3 changes: 3 additions & 0 deletions spec/hatchet/ci_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
LD_LIBRARY_PATH=/app/.heroku/python/lib
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin::/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/
PIP_DISABLE_PIP_VERSION_CHECK=1
PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config
PYTHONUNBUFFERED=1
-----> Saving cache
Expand All @@ -41,6 +42,7 @@
LD_LIBRARY_PATH=/app/.heroku/python/lib
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/
PIP_DISABLE_PIP_VERSION_CHECK=1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
Expand All @@ -54,6 +56,7 @@
LD_LIBRARY_PATH=/app/.heroku/python/lib
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/:/app/.sprettur/bin/
PIP_DISABLE_PIP_VERSION_CHECK=1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
Expand Down
2 changes: 2 additions & 0 deletions spec/hatchet/django_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
remote: 'LD_LIBRARY_PATH': '/app/.heroku/python/lib',
remote: 'LIBRARY_PATH': '/app/.heroku/python/lib',
remote: 'PATH': '/app/.heroku/python/bin::/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
remote: 'PIP_DISABLE_PIP_VERSION_CHECK': '1',
remote: 'PKG_CONFIG_PATH': '/app/.heroku/python/lib/pkg-config',
remote: 'PWD': '/tmp/build_\\w+',
remote: 'PYTHONPATH': '\\.',
Expand Down Expand Up @@ -84,6 +85,7 @@
remote: 'LD_LIBRARY_PATH': '/app/.heroku/python/lib',
remote: 'LIBRARY_PATH': '/app/.heroku/python/lib',
remote: 'PATH': '/app/.heroku/python/bin::/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
remote: 'PIP_DISABLE_PIP_VERSION_CHECK': '1',
remote: 'PKG_CONFIG_PATH': '/invalid-path',
remote: 'PWD': '/tmp/build_\\w+',
remote: 'PYTHONPATH': '/invalid-path',
Expand Down
3 changes: 3 additions & 0 deletions spec/hatchet/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
remote: LD_LIBRARY_PATH=/app/.heroku/python/lib
remote: LIBRARY_PATH=/app/.heroku/python/lib
remote: PATH=/app/.heroku/python/bin::/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
remote: PIP_DISABLE_PIP_VERSION_CHECK=1
remote: PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config
remote: PYTHONUNBUFFERED=1
remote: -----> Saving cache
Expand All @@ -38,6 +39,7 @@
remote: LD_LIBRARY_PATH=/app/.heroku/python/lib
remote: LIBRARY_PATH=/app/.heroku/python/lib
remote: PATH=/app/.heroku/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
remote: PIP_DISABLE_PIP_VERSION_CHECK=1
remote: PYTHONHOME=/app/.heroku/python
remote: PYTHONPATH=/app
remote: PYTHONUNBUFFERED=true
Expand Down Expand Up @@ -106,6 +108,7 @@
LD_LIBRARY_PATH=/app/.heroku/python/lib
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin
PIP_DISABLE_PIP_VERSION_CHECK=1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
Expand Down
1 change: 1 addition & 0 deletions spec/hatchet/profile_d_scripts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
LD_LIBRARY_PATH=/app/.heroku/python/lib:/this-should-be-preserved
LIBRARY_PATH=/app/.heroku/python/lib:/this-should-be-preserved
PATH=/app/.heroku/python/bin:/this-should-be-preserved:/usr/local/bin:/usr/bin:/bin
PIP_DISABLE_PIP_VERSION_CHECK=1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/this-should-be-preserved
PYTHONUNBUFFERED=true
Expand Down