Add Task.set_packages docstring notes (#1224)

This commit is contained in:
pollfly 2024-03-12 13:34:48 +02:00 committed by GitHub
parent b295d0177c
commit 409c588373
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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.

View File

@ -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