mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2025-01-15 08:43:29 +00:00
Dedupe packages (with set()) earlier to improve logging and very slightly improve speed.
This commit is contained in:
parent
17d0272089
commit
22012d4452
@ -193,7 +193,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
|||||||
f"Identified {len(dev_deps)} development dependencies to install to env"
|
f"Identified {len(dev_deps)} development dependencies to install to env"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
dev_deps = []
|
dev_deps = set()
|
||||||
logger.info("Env does not install development dependencies, skipping")
|
logger.info("Env does not install development dependencies, skipping")
|
||||||
|
|
||||||
env_deps = utilities.find_additional_deps(
|
env_deps = utilities.find_additional_deps(
|
||||||
@ -220,7 +220,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
|||||||
f"Identified {len(project_deps)} project dependencies to install to env"
|
f"Identified {len(project_deps)} project dependencies to install to env"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
project_deps = []
|
project_deps = set()
|
||||||
logger.info("Env does not install project package dependencies, skipping")
|
logger.info("Env does not install project package dependencies, skipping")
|
||||||
except exceptions.ToxPoetryInstallerException as err:
|
except exceptions.ToxPoetryInstallerException as err:
|
||||||
venv.status = err.__class__.__name__
|
venv.status = err.__class__.__name__
|
||||||
@ -231,7 +231,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
|||||||
logger.error(f"Internal plugin error: {err}")
|
logger.error(f"Internal plugin error: {err}")
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
dependencies = dev_deps + env_deps + project_deps
|
dependencies = dev_deps | env_deps | project_deps
|
||||||
if (
|
if (
|
||||||
venv.envconfig.config.option.parallel_install_threads
|
venv.envconfig.config.option.parallel_install_threads
|
||||||
!= constants.DEFAULT_INSTALL_THREADS
|
!= constants.DEFAULT_INSTALL_THREADS
|
||||||
|
@ -6,7 +6,7 @@ import concurrent.futures
|
|||||||
import contextlib
|
import contextlib
|
||||||
import typing
|
import typing
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Sequence
|
from typing import Collection
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
from poetry.core.packages.package import Package as PoetryPackage
|
from poetry.core.packages.package import Package as PoetryPackage
|
||||||
@ -22,7 +22,7 @@ if typing.TYPE_CHECKING:
|
|||||||
def install(
|
def install(
|
||||||
poetry: "_poetry.Poetry",
|
poetry: "_poetry.Poetry",
|
||||||
venv: ToxVirtualEnv,
|
venv: ToxVirtualEnv,
|
||||||
packages: Sequence[PoetryPackage],
|
packages: Collection[PoetryPackage],
|
||||||
parallels: int = 0,
|
parallels: int = 0,
|
||||||
):
|
):
|
||||||
"""Install a bunch of packages to a virtualenv
|
"""Install a bunch of packages to a virtualenv
|
||||||
|
@ -182,7 +182,7 @@ def find_project_deps(
|
|||||||
venv: "_poetry.VirtualEnv",
|
venv: "_poetry.VirtualEnv",
|
||||||
poetry: "_poetry.Poetry",
|
poetry: "_poetry.Poetry",
|
||||||
extras: Sequence[str] = (),
|
extras: Sequence[str] = (),
|
||||||
) -> List[PoetryPackage]:
|
) -> Set[PoetryPackage]:
|
||||||
"""Find the root project dependencies
|
"""Find the root project dependencies
|
||||||
|
|
||||||
Recursively identify the dependencies of the root project package
|
Recursively identify the dependencies of the root project package
|
||||||
@ -218,7 +218,7 @@ def find_project_deps(
|
|||||||
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||||
)
|
)
|
||||||
|
|
||||||
return dependencies
|
return set(dependencies)
|
||||||
|
|
||||||
|
|
||||||
def find_additional_deps(
|
def find_additional_deps(
|
||||||
@ -226,7 +226,7 @@ def find_additional_deps(
|
|||||||
venv: "_poetry.VirtualEnv",
|
venv: "_poetry.VirtualEnv",
|
||||||
poetry: "_poetry.Poetry",
|
poetry: "_poetry.Poetry",
|
||||||
dep_names: Sequence[str],
|
dep_names: Sequence[str],
|
||||||
) -> List[PoetryPackage]:
|
) -> Set[PoetryPackage]:
|
||||||
"""Find additional dependencies
|
"""Find additional dependencies
|
||||||
|
|
||||||
Recursively identify the dependencies of an arbitrary list of package names
|
Recursively identify the dependencies of an arbitrary list of package names
|
||||||
@ -243,12 +243,12 @@ def find_additional_deps(
|
|||||||
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||||
)
|
)
|
||||||
|
|
||||||
return dependencies
|
return set(dependencies)
|
||||||
|
|
||||||
|
|
||||||
def find_dev_deps(
|
def find_dev_deps(
|
||||||
packages: PackageMap, venv: "_poetry.VirtualEnv", poetry: "_poetry.Poetry"
|
packages: PackageMap, venv: "_poetry.VirtualEnv", poetry: "_poetry.Poetry"
|
||||||
) -> List[PoetryPackage]:
|
) -> Set[PoetryPackage]:
|
||||||
"""Find the dev dependencies
|
"""Find the dev dependencies
|
||||||
|
|
||||||
Recursively identify the Poetry dev dependencies
|
Recursively identify the Poetry dev dependencies
|
||||||
@ -261,7 +261,11 @@ def find_dev_deps(
|
|||||||
packages,
|
packages,
|
||||||
venv,
|
venv,
|
||||||
poetry,
|
poetry,
|
||||||
poetry.pyproject.data["tool"]["poetry"].get("group", {}).get("dev", {}).get("dependencies", {}).keys()
|
poetry.pyproject.data["tool"]["poetry"]
|
||||||
|
.get("group", {})
|
||||||
|
.get("dev", {})
|
||||||
|
.get("dependencies", {})
|
||||||
|
.keys(),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Legacy pyproject.toml poetry format:
|
# Legacy pyproject.toml poetry format:
|
||||||
|
Loading…
Reference in New Issue
Block a user