Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dec28be

Browse files
committedApr 30, 2022
DRAFT - pip install --dry-run
1 parent 2fc69aa commit dec28be

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎src/pip/_internal/commands/install.py

+16
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ def add_options(self) -> None:
239239
),
240240
)
241241

242+
self.cmd_opts.add_option(
243+
"--dry-run",
244+
action="store_true",
245+
dest="dry_run",
246+
default=False,
247+
help=(
248+
"Don't actually install anything, just print what would be. "
249+
"Can be used in combination with --report and --ignore-installed "
250+
"to 'resolve' the requirements."
251+
),
252+
)
253+
242254
self.cmd_opts.add_option(cmdoptions.no_binary())
243255
self.cmd_opts.add_option(cmdoptions.only_binary())
244256
self.cmd_opts.add_option(cmdoptions.prefer_binary())
@@ -361,6 +373,10 @@ def run(self, options: Values, args: List[str]) -> int:
361373
with open(options.json_report_file, "w") as f:
362374
json.dump(report.to_json(), f)
363375

376+
if options.dry_run:
377+
# TODO print something useful here
378+
return SUCCESS
379+
364380
try:
365381
pip_req = requirement_set.get_requirement("pip")
366382
except KeyError:

0 commit comments

Comments
 (0)