Skip to content

Commit f494222

Browse files
Merge pull request #5905 from jerbob92/feature/only-call-pip-compile-once
Only call pip compile once
2 parents 6981610 + fbdad5a commit f494222

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

python/lib/dependabot/python/file_updater/pip_compile_file_updater.rb

-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ def compile_new_requirement_files
8181
"#{SharedHelpers.escape_command(version_part)}",
8282
allow_unsafe_shell_command: true
8383
)
84-
# Run pip-compile a second time, without an update argument, to
85-
# ensure it resets the right comments.
86-
run_pip_compile_command(
87-
"pyenv exec pip-compile #{pip_compile_options(filename)} " \
88-
"#{filename}"
89-
)
9084
end
9185

9286
# Remove any .python-version file before parsing the reqs

python/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb

+11-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,17 @@ def fetch_latest_resolvable_version_string(requirement:)
8080
run_pip_compile_command(
8181
"pyenv exec pip-compile -v #{pip_compile_options(filename)} -P #{dependency.name} #{filename}"
8282
)
83-
# Run pip-compile a second time, without an update argument,
84-
# to ensure it handles markers correctly
85-
write_original_manifest_files unless dependency.top_level?
83+
84+
next if dependency.top_level?
85+
86+
# Run pip-compile a second time for transient dependencies
87+
# to make sure we do not update dependencies that are
88+
# superfluous. pip-compile does not detect these when
89+
# updating a specific dependency with the -P option.
90+
# Running pip-compile a second time will automatically remove
91+
# superfluous dependencies. Dependabot then marks those with
92+
# update_not_possible.
93+
write_original_manifest_files
8694
run_pip_compile_command(
8795
"pyenv exec pip-compile #{pip_compile_options(filename)} #{filename}"
8896
)

0 commit comments

Comments
 (0)