Skip to content

Commit 4687d11

Browse files
improve pooled progress output for BatchDownloader
- use more specific types for BatchDownloader#__call__ - calculate byte lengths with a HEAD request - quiet all progress output from -q - don't write colored output with --no-color - write a lot more documentation for the new progress bar logic - use ProgressBarType enum for --progress-bar CLI flag
1 parent 858a515 commit 4687d11

File tree

10 files changed

+671
-99
lines changed

10 files changed

+671
-99
lines changed

news/12923.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use very rich progress output for batch downloading. Use ``ProgressBarType`` enum class for ``--progress-bar`` choices.

src/pip/_internal/cli/cmdoptions.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from pip._vendor.packaging.utils import canonicalize_name
2323

2424
from pip._internal.cli.parser import ConfigOptionParser
25+
from pip._internal.cli.progress_bars import ProgressBarType
2526
from pip._internal.exceptions import CommandError
2627
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
2728
from pip._internal.models.format_control import FormatControl
@@ -226,11 +227,15 @@ class PipOption(Option):
226227
"--progress-bar",
227228
dest="progress_bar",
228229
type="choice",
229-
choices=["on", "off", "raw"],
230-
default="on",
231-
help="Specify whether the progress bar should be used [on, off, raw] (default: on)",
230+
choices=ProgressBarType.choices(),
231+
default=ProgressBarType.ON.value,
232+
help=(
233+
"Specify whether the progress bar should be used"
234+
f" {ProgressBarType.help_choices()} (default: %default)"
235+
),
232236
)
233237

238+
234239
log: Callable[..., Option] = partial(
235240
PipOption,
236241
"--log",

0 commit comments

Comments
 (0)