From 409c5883738d978df8835e7f7ffb75b414957e2d Mon Sep 17 00:00:00 2001 From: pollfly <75068813+pollfly@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:34:48 +0200 Subject: [PATCH] Add Task.set_packages docstring notes (#1224) --- clearml/backend_interface/task/task.py | 5 +++++ clearml/task.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clearml/backend_interface/task/task.py b/clearml/backend_interface/task/task.py index 6b7da1ab..cafbe409 100644 --- a/clearml/backend_interface/task/task.py +++ b/clearml/backend_interface/task/task.py @@ -2267,6 +2267,11 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin): Alternatively, you can add all requirements from a file. Example: Task.add_requirements('/path/to/your/project/requirements.txt') + .. note:: + Task.add_requirements does not directly modify the task's requirements. Instead, it improves the accuracy + of capturing a task's Python packages. To explicitly change task requirements, use + Task.set_packages, which overwrites existing packages with the specified ones. + :param str package_name: The package name or path to a requirements file to add to the "Installed Packages" section of the task. :param package_version: The package version requirements. If ``None``, then use the installed version. diff --git a/clearml/task.py b/clearml/task.py index 501308af..08fb3a4e 100644 --- a/clearml/task.py +++ b/clearml/task.py @@ -1580,7 +1580,8 @@ class Task(_Task): def set_packages(self, packages): # type: (Union[str, Path, Sequence[str]]) -> () """ - Manually specify a list of required packages or a local requirements.txt file. + Manually specify a list of required packages or a local requirements.txt file. Note that this will + overwrite all existing packages. When running remotely this call is ignored