Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute batch downloads in parallel worker threads #12923

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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/12923.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Download concrete dists for metadata-only resolves in parallel using worker threads. Add ``--batch-download-parallelism`` CLI flag to limit parallelism.
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.
28 changes: 25 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,32 @@ 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)"
),
)


batch_download_parallelism: Callable[..., Option] = partial(
Option,
"--batch-download-parallelism",
dest="batch_download_parallelism",
type="int",
default=10,
help=(
"Maximum parallelism employed for batch downloading of metadata-only dists"
" (default %default parallel requests)."
" Note that more than 10 downloads may overflow the requests connection pool,"
" which may affect performance."
" Note also that commands such as 'install --dry-run' should avoid downloads"
" entirely, and so will not be affected by this option."
),
)


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