From 6b84764d5db801a813b6a620dd11e2ef9fb6a7e7 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Wed, 5 May 2021 16:35:46 -0400 Subject: [PATCH] Add option to disable installation of project dependencies Fixes #53 --- tox_poetry_installer/hooks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tox_poetry_installer/hooks.py b/tox_poetry_installer/hooks.py index 871c9f6..dcaa94e 100644 --- a/tox_poetry_installer/hooks.py +++ b/tox_poetry_installer/hooks.py @@ -58,6 +58,13 @@ def tox_addoption(parser: ToxParser): help="Automatically install all Poetry development dependencies to the environment", ) + parser.add_testenv_attribute( + name="install_project_deps", + type="bool", + default=True, + help="Automatically install all Poetry primary dependencies to the environment", + ) + parser.add_testenv_attribute( name="require_locked_deps", type="bool", @@ -140,7 +147,11 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional f"Identified {len(env_deps)} environment dependencies to install to env" ) - if not venv.envconfig.skip_install and not venv.envconfig.config.skipsdist: + if ( + not venv.envconfig.skip_install + and not venv.envconfig.config.skipsdist + and venv.envconfig.install_project_deps + ): project_deps = utilities.find_project_deps( packages, virtualenv, poetry, venv.envconfig.extras ) @@ -149,7 +160,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional ) else: project_deps = [] - logger.info("Env does not install project package, skipping") + logger.info("Env does not install project package dependencies, skipping") except exceptions.ToxPoetryInstallerException as err: venv.status = err.__class__.__name__ logger.error(str(err))