From 154db59ce6306a201be0869df506d43c6a3cd9d9 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Tue, 28 Mar 2023 14:37:48 +0300 Subject: [PATCH] Add agent.package_manager.poetry_install_extra_args configuration option --- clearml_agent/backend_api/config/default/agent.conf | 1 + clearml_agent/helper/package/poetry_api.py | 5 +++++ docs/clearml.conf | 1 + 3 files changed, 7 insertions(+) diff --git a/clearml_agent/backend_api/config/default/agent.conf b/clearml_agent/backend_api/config/default/agent.conf index 5ba4423..eef86ed 100644 --- a/clearml_agent/backend_api/config/default/agent.conf +++ b/clearml_agent/backend_api/config/default/agent.conf @@ -69,6 +69,7 @@ pip_version: ["<20.2 ; python_version < '3.10'", "<22.3 ; python_version >= '3.10'"], # specify poetry version to use (examples "<2", "==1.1.1", "", empty string will install the latest version) # poetry_version: "<2", + # poetry_install_extra_args: ["-v"] # virtual environment inherits packages from system system_site_packages: false, diff --git a/clearml_agent/helper/package/poetry_api.py b/clearml_agent/helper/package/poetry_api.py index fa1a5fc..5687a1a 100644 --- a/clearml_agent/helper/package/poetry_api.py +++ b/clearml_agent/helper/package/poetry_api.py @@ -69,6 +69,11 @@ class PoetryConfig: path = path.replace(':'+sys.base_prefix, ':'+sys.real_prefix, 1) kwargs['env']['PATH'] = path + if self.session and self.session.config: + extra_args = self.session.config.get("agent.package_manager.poetry_install_extra_args", None) + if extra_args: + args = args + tuple(extra_args) + if check_if_command_exists("poetry"): argv = Argv("poetry", *args) else: diff --git a/docs/clearml.conf b/docs/clearml.conf index fdb4b09..cba1c8a 100644 --- a/docs/clearml.conf +++ b/docs/clearml.conf @@ -82,6 +82,7 @@ agent { # pip_version: ["<20.2 ; python_version < '3.10'", "<22.3 ; python_version >= '3.10'"] # specify poetry version to use (examples "<2", "==1.1.1", "", empty string will install the latest version) # poetry_version: "<2", + # poetry_install_extra_args: ["-v"] # virtual environment inheres packages from system system_site_packages: false,