Skip to content

Commit e754fd6

Browse files
committed
make 1 the default value of the parallel-downloads arguement
1 parent fa268ae commit e754fd6

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

src/pip/_internal/cli/cmdoptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def _handle_no_cache_dir(
770770
dest="parallel_downloads",
771771
type="int",
772772
metavar="n",
773-
default=None,
773+
default=1,
774774
help=(
775775
"Use upto <n> threads to download packages in parallel."
776776
"<n> must be greater than 0"

src/pip/_internal/cli/req_command.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,14 @@ def _build_session(
118118
ssl_context = None
119119
else:
120120
ssl_context = None
121-
if "parallel_downloads" in options.__dict__:
122-
parallel_downloads = options.parallel_downloads
123-
else:
124-
parallel_downloads = None
125121

126122
session = PipSession(
127123
cache=os.path.join(cache_dir, "http-v2") if cache_dir else None,
128124
retries=retries if retries is not None else options.retries,
129125
trusted_hosts=options.trusted_hosts,
130126
index_urls=self._get_index_urls(options),
131127
ssl_context=ssl_context,
132-
parallel_downloads=parallel_downloads,
128+
parallel_downloads=options.parallel_downloads,
133129
)
134130

135131
# Handle custom ca-bundles from the user

src/pip/_internal/commands/download.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ def add_options(self) -> None:
7878

7979
@with_cleanup
8080
def run(self, options: Values, args: List[str]) -> int:
81-
if (options.parallel_downloads is not None) and (
82-
options.parallel_downloads < 1
83-
):
81+
if options.parallel_downloads < 1:
8482
raise CommandError("Value of '--parallel-downloads' must be greater than 0")
8583

8684
options.ignore_installed = True

src/pip/_internal/network/session.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def __init__(
326326
trusted_hosts: Sequence[str] = (),
327327
index_urls: Optional[List[str]] = None,
328328
ssl_context: Optional["SSLContext"] = None,
329-
parallel_downloads: Optional[int] = None,
329+
parallel_downloads: int = 1,
330330
**kwargs: Any,
331331
) -> None:
332332
"""
@@ -367,9 +367,7 @@ def __init__(
367367
# pip._internal.network.BatchDownloader and to set pool_connection in
368368
# the HTTPAdapter to prevent connection pool from hitting the default(10)
369369
# limit and throwing 'Connection pool is full' warnings
370-
self.parallel_downloads = (
371-
parallel_downloads if (parallel_downloads is not None) else 1
372-
)
370+
self.parallel_downloads = parallel_downloads
373371
pool_maxsize = max(self.parallel_downloads, 10)
374372
# Our Insecure HTTPAdapter disables HTTPS validation. It does not
375373
# support caching so we'll use it for all http:// URLs.

0 commit comments

Comments
 (0)