From ff8675e4b6922b1df74a79579bd20b4dc1711b1e Mon Sep 17 00:00:00 2001 From: Eric Gustin <34000337+EricGustin@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:07:15 -0700 Subject: [PATCH] Filter out unneeded files/directories before deploying workers (#464) `arcade deploy` is failing for local packages that have large unneeded files such as `uv.lock`. It is failing because it is taking too long for the CLI to compress and PUT to the cloud. --- libs/arcade-cli/arcade_cli/deployment.py | 20 +++++++++++++++++++- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libs/arcade-cli/arcade_cli/deployment.py b/libs/arcade-cli/arcade_cli/deployment.py index 991eba25..342c8e96 100644 --- a/libs/arcade-cli/arcade_cli/deployment.py +++ b/libs/arcade-cli/arcade_cli/deployment.py @@ -226,6 +226,24 @@ class Worker(BaseModel): if self.local_source is None: return None + def exclude_filter(tarinfo: tarfile.TarInfo) -> tarfile.TarInfo | None: + """Filter for files/directories to exclude from the compressed package""" + basename = os.path.basename(tarinfo.name) + + # Exclude all hidden directories/files + if basename.startswith("."): + return None + + # Exclude specific directories/files + if basename in {"dist", "build", "__pycache__", "venv", "coverage.xml"}: + return None + + # Exclude lock files + if basename.endswith(".lock"): + return None + + return tarinfo + # Compress local packages into a list of LocalPackage objects def process_package(package_path_str: str) -> LocalPackage: package_path = self.toml_path.parent / package_path_str @@ -247,7 +265,7 @@ class Worker(BaseModel): # Compress the package into a byte stream and tar byte_stream = io.BytesIO() with tarfile.open(fileobj=byte_stream, mode="w:gz") as tar: - tar.add(package_path, arcname=package_path.name) + tar.add(package_path, arcname=package_path.name, filter=exclude_filter) byte_stream.seek(0) package_bytes = byte_stream.read() diff --git a/pyproject.toml b/pyproject.toml index f4c92fcd..b5ef990d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "arcade-ai" -version = "2.0.2" +version = "2.0.3" description = "Arcade.dev - Tool Calling platform for Agents" readme = "README.md" license = {file = "LICENSE"}