Skip to content

Commit caa1a19

Browse files
authored
Stop filtering out pip's "Requirement already satisfied" log lines (#1765)
Since while removing them makes the install logs slightly shorter, it hides what is happening and makes it harder to see what package version a historic build may have been using from the logs alone. For example, when comparing a last successful build to a newly failing build. This now matches the behaviour for our other supported package managers, where we don't filter out install lines relating to already installed/cached packages. As a compromise, we still edit the lines slightly, to remove the redundant site-packages path information, which would otherwise cause each package message to span multiple lines. GUS-W-17897541.
1 parent 3033b54 commit caa1a19

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased]
44

5+
- Stopped filtering out pip's `Requirement already satisfied:` log lines when installing dependencies. ([#1765](https://github.com/heroku/heroku-buildpack-python/pull/1765))
56
- Improved the error messages shown if installing pip/Poetry/Pipenv fails. ([#1764](https://github.com/heroku/heroku-buildpack-python/pull/1764))
67
- Stopped installing pip into Poetry's virtual environment. ([#1761](https://github.com/heroku/heroku-buildpack-python/pull/1761))
78

lib/pip.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ function pip::install_dependencies() {
106106
# We only display the most relevant command args here, to improve the signal to noise ratio.
107107
output::step "Installing dependencies using '${pip_install_command[*]}'"
108108

109+
# The sed usage is to reduce the verbosity of output lines like:
110+
# "Requirement already satisfied: typing-extensions==4.12.2 in /app/.heroku/python/lib/python3.13/site-packages (from -r requirements.txt (line 5)) (4.12.2)"
109111
# shellcheck disable=SC2310 # This function is invoked in an 'if' condition so set -e will be disabled.
110112
if ! {
111113
"${pip_install_command[@]}" \
@@ -116,7 +118,7 @@ function pip::install_dependencies() {
116118
--progress-bar off \
117119
--src='/app/.heroku/python/src' \
118120
|& tee "${WARNINGS_LOG:?}" \
119-
|& sed --unbuffered --expression '/Requirement already satisfied/d' \
121+
|& sed --unbuffered --expression 's# in /app/.heroku/python/lib/python.*/site-packages##' \
120122
|& output::indent
121123
}; then
122124
# TODO: Overhaul warnings and combine them with error handling.

spec/hatchet/ci_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@
6262
REGEX
6363

6464
test_run.run_again
65-
expect(clean_output(test_run.output)).to include(<<~OUTPUT)
65+
expect(clean_output(test_run.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
6666
-----> Python app detected
6767
-----> Using Python #{DEFAULT_PYTHON_MAJOR_VERSION} specified in .python-version
6868
-----> Restoring cache
6969
-----> Using cached install of Python #{DEFAULT_PYTHON_FULL_VERSION}
7070
-----> Installing pip #{PIP_VERSION}
7171
-----> Installing dependencies using 'pip install -r requirements.txt -r requirements-test.txt'
72+
Requirement already satisfied: typing-extensions==.+
73+
Requirement already satisfied: pytest==.+
74+
.+
7275
-----> Skipping Django collectstatic since the env var DISABLE_COLLECTSTATIC is set.
7376
-----> Running bin/post_compile hook
74-
OUTPUT
77+
REGEX
7578
end
7679
end
7780
end

spec/hatchet/pip_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
remote: -----> Using cached install of Python #{DEFAULT_PYTHON_FULL_VERSION}
5454
remote: -----> Installing pip #{PIP_VERSION}
5555
remote: -----> Installing dependencies using 'pip install -r requirements.txt'
56+
remote: Requirement already satisfied: typing-extensions==4.12.2 (from -r requirements.txt (line 5)) (4.12.2)
5657
remote: -----> Inline app detected
5758
OUTPUT
5859
end

0 commit comments

Comments
 (0)