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

Stop filtering out pip's "Requirement already satisfied" log lines #1765

Merged
merged 1 commit into from
Feb 24, 2025
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 @@ -2,6 +2,7 @@

## [Unreleased]

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

Expand Down
4 changes: 3 additions & 1 deletion lib/pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ function pip::install_dependencies() {
# We only display the most relevant command args here, to improve the signal to noise ratio.
output::step "Installing dependencies using '${pip_install_command[*]}'"

# The sed usage is to reduce the verbosity of output lines like:
# "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)"
# shellcheck disable=SC2310 # This function is invoked in an 'if' condition so set -e will be disabled.
if ! {
"${pip_install_command[@]}" \
Expand All @@ -116,7 +118,7 @@ function pip::install_dependencies() {
--progress-bar off \
--src='/app/.heroku/python/src' \
|& tee "${WARNINGS_LOG:?}" \
|& sed --unbuffered --expression '/Requirement already satisfied/d' \
|& sed --unbuffered --expression 's# in /app/.heroku/python/lib/python.*/site-packages##' \
|& output::indent
}; then
# TODO: Overhaul warnings and combine them with error handling.
Expand Down
7 changes: 5 additions & 2 deletions spec/hatchet/ci_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@
REGEX

test_run.run_again
expect(clean_output(test_run.output)).to include(<<~OUTPUT)
expect(clean_output(test_run.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
-----> Python app detected
-----> Using Python #{DEFAULT_PYTHON_MAJOR_VERSION} specified in .python-version
-----> Restoring cache
-----> Using cached install of Python #{DEFAULT_PYTHON_FULL_VERSION}
-----> Installing pip #{PIP_VERSION}
-----> Installing dependencies using 'pip install -r requirements.txt -r requirements-test.txt'
Requirement already satisfied: typing-extensions==.+
Requirement already satisfied: pytest==.+
.+
-----> Skipping Django collectstatic since the env var DISABLE_COLLECTSTATIC is set.
-----> Running bin/post_compile hook
OUTPUT
REGEX
end
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/hatchet/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
remote: -----> Using cached install of Python #{DEFAULT_PYTHON_FULL_VERSION}
remote: -----> Installing pip #{PIP_VERSION}
remote: -----> Installing dependencies using 'pip install -r requirements.txt'
remote: Requirement already satisfied: typing-extensions==4.12.2 (from -r requirements.txt (line 5)) (4.12.2)
remote: -----> Inline app detected
OUTPUT
end
Expand Down