-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Describe the bug
For example here, the overload definition suggests that an argument remote_path can be supplied:
daytona/libs/sdk-python/src/daytona/_sync/filesystem.py
Lines 566 to 595 in f90ce78
| @overload | |
| def upload_file(self, file: bytes, remote_path: str, timeout: int = 30 * 60) -> None: | |
| """Uploads a file to the specified path in the Sandbox. If a file already exists at | |
| the destination path, it will be overwritten. This method is useful when you want to upload | |
| small files that fit into memory. | |
| Args: | |
| file (bytes): File contents as a bytes object. | |
| remote_path (str): Path to the destination file. Relative paths are resolved based on | |
| the sandbox working directory. | |
| timeout (int): Timeout for the upload operation in seconds. 0 means no timeout. Default is 30 minutes. | |
| Example: | |
| ```python | |
| # Upload a text file | |
| content = b"Hello, World!" | |
| sandbox.fs.upload_file(content, "tmp/hello.txt") | |
| # Upload a local file | |
| with open("local_file.txt", "rb") as f: | |
| content = f.read() | |
| sandbox.fs.upload_file(content, "tmp/file.txt") | |
| # Upload binary data | |
| import json | |
| data = {"key": "value"} | |
| content = json.dumps(data).encode('utf-8') | |
| sandbox.fs.upload_file(content, "tmp/config.json") | |
| ``` | |
| """ |
But doing so causes it to raises and error:
await sandbox.fs.upload_file(
^^^^^^^^^^^^^^^^^^^^^^^
remote_path="/tmp/test",
file=b"test",
)
TypeError: AsyncFileSystem.upload_file() got an unexpected keyword argument 'remote_path'
This is not surprising because the actual function definition does not accept remote_path at all:
daytona/libs/sdk-python/src/daytona/_sync/filesystem.py
Lines 616 to 619 in f90ce78
| def upload_file( # pyright: ignore[reportInconsistentOverload] | |
| self, src: str | bytes, dst: str, timeout: int = 30 * 60 | |
| ) -> None: | |
| self.upload_files([FileUpload(src, dst)], timeout) |
To Reproduce
Use keyword arguments with API
Expected behavior
The API overloads should not use parameter names which do not work.
If for some reason only positional-only arguments are expected, the overloads should use / marker to specify it (see https://peps.python.org/pep-0570/).
Screenshots
None
Environment (required fields):
- Daytona client: Latest as quoted by code
- Daytona Version: [Found in the dashboard]
Additional context
Add any other context about the problem here.