mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2024-12-04 01:30:09 +00:00
Add config support for the parallelization functionality
This commit is contained in:
parent
06fcd56172
commit
5e33af6eb2
@ -34,6 +34,14 @@ def tox_addoption(parser: ToxParser):
|
||||
help="Trigger a failure if Poetry is not available to Tox",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--parallelize-locked-install",
|
||||
type=int,
|
||||
dest="parallelize_locked_install",
|
||||
default=None,
|
||||
help="Number of worker threads to use for installing dependencies from the Poetry lockfile in parallel",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="install_dev_deps",
|
||||
type="bool",
|
||||
@ -143,10 +151,21 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
||||
raise err
|
||||
|
||||
dependencies = dev_deps + env_deps + project_deps
|
||||
log_parallel = (
|
||||
f" (using {venv.envconfig.config.option.parallelize_locked_install} threads)"
|
||||
if venv.envconfig.config.option.parallelize_locked_install
|
||||
else ""
|
||||
)
|
||||
|
||||
action.setactivity(
|
||||
__about__.__title__,
|
||||
f"Installing {len(dependencies)} dependencies from Poetry lock file",
|
||||
f"Installing {len(dependencies)} dependencies from Poetry lock file{log_parallel}",
|
||||
)
|
||||
installer.install(
|
||||
poetry,
|
||||
venv,
|
||||
dependencies,
|
||||
venv.envconfig.config.option.parallelize_locked_install,
|
||||
)
|
||||
installer.install(poetry, venv, dependencies)
|
||||
|
||||
return venv.envconfig.require_locked_deps or None
|
||||
|
Loading…
Reference in New Issue
Block a user