From 93990c24bedab60f8db5859e69cd1726c4952f4c Mon Sep 17 00:00:00 2001 From: Jonathan Ehwald Date: Fri, 14 Nov 2025 17:58:47 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Speed=20up=20archive=20cre?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + src/fastapi_cloud_cli/commands/deploy.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1ce12e6..93cfbbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ dependencies = [ "rich-toolkit >= 0.14.5", "pydantic[email] >= 1.6.1", "sentry-sdk >= 2.20.0", + "fastar >= 0.5.0", ] [project.optional-dependencies] diff --git a/src/fastapi_cloud_cli/commands/deploy.py b/src/fastapi_cloud_cli/commands/deploy.py index d2df397..a94298c 100644 --- a/src/fastapi_cloud_cli/commands/deploy.py +++ b/src/fastapi_cloud_cli/commands/deploy.py @@ -2,7 +2,6 @@ import json import logging import subprocess -import tarfile import tempfile import time from enum import Enum @@ -10,6 +9,7 @@ from pathlib import Path from typing import Any, Dict, Generator, List, Optional, Union +import fastar import rignore import typer from httpx import Client @@ -56,13 +56,14 @@ def archive(path: Path, tar_path: Path) -> Path: logger.debug("Archive will be created at: %s", tar_path) file_count = 0 - with tarfile.open(tar_path, "w") as tar: + with fastar.open(tar_path, "w") as tar: for filename in files: if filename.is_dir(): continue - logger.debug("Adding %s to archive", filename.relative_to(path)) - tar.add(filename, arcname=filename.relative_to(path)) + arcname = filename.relative_to(path) + logger.debug("Adding %s to archive", arcname) + tar.append(filename, arcname=arcname) file_count += 1 logger.debug("Archive created successfully with %s files", file_count)