Skip to content
Open
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 news/12925.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use very rich progress output for batch downloading. Use ``ProgressBarType`` enum class for ``--progress-bar`` choices.
8 changes: 6 additions & 2 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from pip._internal.cli import cmdoptions
from pip._internal.cli.command_context import CommandContextMixIn
from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip._internal.cli.progress_bars import ProgressBarType
from pip._internal.cli.status_codes import (
ERROR,
PREVIOUS_BUILD_DIR_ERROR,
Expand Down Expand Up @@ -176,8 +177,11 @@ def _main(self, args: list[str]) -> int:
if options.debug_mode:
self.verbosity = 2

if hasattr(options, "progress_bar") and options.progress_bar == "auto":
options.progress_bar = "on" if self.verbosity >= 0 else "off"
if getattr(options, "progress_bar", None) == ProgressBarType.AUTO.value:
if self.verbosity >= 0:
options.progress_bar = ProgressBarType.ON.value
else:
options.progress_bar = ProgressBarType.OFF.value

reconfigure(no_color=options.no_color)
level_number = setup_logging(
Expand Down
7 changes: 4 additions & 3 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.cli.parser import ConfigOptionParser
from pip._internal.cli.progress_bars import ProgressBarType
from pip._internal.exceptions import CommandError
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
from pip._internal.models.format_control import FormatControl
Expand Down Expand Up @@ -228,12 +229,12 @@ class PipOption(Option):
"--progress-bar",
dest="progress_bar",
type="choice",
choices=["auto", "on", "off", "raw"],
default="auto",
choices=ProgressBarType.choices(),
default=ProgressBarType.AUTO.value,
help=(
"Specify whether the progress bar should be used. In 'auto'"
" mode, --quiet will suppress all progress bars."
" [auto, on, off, raw] (default: auto)"
f" {ProgressBarType.help_choices()} (default: %default)"
),
)

Expand Down
Loading
Loading