Skip to content

Commit

Permalink
improve pooled progress output for BatchDownloader
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
cosmicexplorer committed Aug 20, 2024
1 parent 858a515 commit 4687d11
Show file tree
Hide file tree
Showing 10 changed files with 671 additions and 99 deletions.
1 change: 1 addition & 0 deletions news/12923.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.
11 changes: 8 additions & 3 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 @@ -226,11 +227,15 @@ class PipOption(Option):
"--progress-bar",
dest="progress_bar",
type="choice",
choices=["on", "off", "raw"],
default="on",
help="Specify whether the progress bar should be used [on, off, raw] (default: on)",
choices=ProgressBarType.choices(),
default=ProgressBarType.ON.value,
help=(
"Specify whether the progress bar should be used"
f" {ProgressBarType.help_choices()} (default: %default)"
),
)


log: Callable[..., Option] = partial(
PipOption,
"--log",
Expand Down
Loading

0 comments on commit 4687d11

Please sign in to comment.