From 4411e6e36254ea878d8b5504b6bfb9db38f98ec1 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Mon, 4 Aug 2025 11:36:13 -0500 Subject: [PATCH] chore(ci): remove reportlab dep (#3033) # What does this PR do? remove reportlab dep. change dynamic pdf generation into a pre-computed pdf. ## Test Plan ci --- pyproject.toml | 1 - .../inference/test_openai_completion.py | 20 ++----------------- uv.lock | 17 +--------------- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0bbffec5c..d85a0fa02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,7 +115,6 @@ test = [ "sqlalchemy[asyncio]>=2.0.41", "requests", "pymilvus>=2.5.12", - "reportlab", "weaviate-client>=4.16.4", ] docs = [ diff --git a/tests/integration/inference/test_openai_completion.py b/tests/integration/inference/test_openai_completion.py index 14254baa7..9927b6ee7 100644 --- a/tests/integration/inference/test_openai_completion.py +++ b/tests/integration/inference/test_openai_completion.py @@ -5,14 +5,8 @@ # the root directory of this source tree. -import base64 -import os -import tempfile - import pytest from openai import OpenAI -from reportlab.lib.pagesizes import letter -from reportlab.pdfgen import canvas from llama_stack.core.library_client import LlamaStackAsLibraryClient @@ -437,18 +431,8 @@ def test_inference_store_tool_calls(compat_client, client_with_models, text_mode def test_openai_chat_completion_non_streaming_with_file(openai_client, client_with_models, text_model_id): skip_if_provider_isnt_openai(client_with_models, text_model_id) - # Generate temporary PDF with "Hello World" text - with tempfile.NamedTemporaryFile(suffix=".pdf", delete=False) as temp_pdf: - c = canvas.Canvas(temp_pdf.name, pagesize=letter) - c.drawString(100, 750, "Hello World") - c.save() - - # Read the PDF and sencode to base64 - with open(temp_pdf.name, "rb") as pdf_file: - pdf_base64 = base64.b64encode(pdf_file.read()).decode("utf-8") - - # Clean up temporary file - os.unlink(temp_pdf.name) + # Hardcoded base64-encoded PDF with "Hello World" text + pdf_base64 = "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovQ29udGVudHMgNCAwIFIKL1Jlc291cmNlcyA8PAovRm9udCA8PAovRjEgPDwKL1R5cGUgL0ZvbnQKL1N1YnR5cGUgL1R5cGUxCi9CYXNlRm9udCAvSGVsdmV0aWNhCj4+Cj4+Cj4+Cj4+CmVuZG9iago0IDAgb2JqCjw8Ci9MZW5ndGggNDQKPj4Kc3RyZWFtCkJUCi9GMSAxMiBUZgoxMDAgNzUwIFRkCihIZWxsbyBXb3JsZCkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNQowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1OCAwMDAwMCBuIAowMDAwMDAwMTE1IDAwMDAwIG4gCjAwMDAwMDAzMTUgMDAwMDAgbiAKdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo0MDkKJSVFT0Y=" response = openai_client.chat.completions.create( model=text_model_id, diff --git a/uv.lock b/uv.lock index 2d350fb6c..cb3d0d56c 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.12" resolution-markers = [ "(python_full_version >= '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", @@ -1630,7 +1630,6 @@ test = [ { name = "openai" }, { name = "pymilvus" }, { name = "pypdf" }, - { name = "reportlab" }, { name = "requests" }, { name = "sqlalchemy", extra = ["asyncio"] }, { name = "torch", version = "2.7.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'darwin'" }, @@ -1746,7 +1745,6 @@ test = [ { name = "openai" }, { name = "pymilvus", specifier = ">=2.5.12" }, { name = "pypdf" }, - { name = "reportlab" }, { name = "requests" }, { name = "sqlalchemy" }, { name = "sqlalchemy", extras = ["asyncio"], specifier = ">=2.0.41" }, @@ -3487,19 +3485,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/45/94/bc295babb3062a731f52621cdc992d123111282e291abaf23faa413443ea/regex-2024.11.6-cp313-cp313-win_amd64.whl", hash = "sha256:2b3361af3198667e99927da8b84c1b010752fa4b1115ee30beaa332cabc3ef1a", size = 273545, upload-time = "2024-11-06T20:11:15Z" }, ] -[[package]] -name = "reportlab" -version = "4.4.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "charset-normalizer" }, - { name = "pillow" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/2f/83/3d44b873fa71ddc7d323c577fe4cfb61e05b34d14e64b6a232f9cfbff89d/reportlab-4.4.3.tar.gz", hash = "sha256:073b0975dab69536acd3251858e6b0524ed3e087e71f1d0d1895acb50acf9c7b", size = 3887532, upload-time = "2025-07-23T11:18:23.799Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/52/c8/aaf4e08679e7b1dc896ad30de0d0527f0fd55582c2e6deee4f2cc899bf9f/reportlab-4.4.3-py3-none-any.whl", hash = "sha256:df905dc5ec5ddaae91fc9cb3371af863311271d555236410954961c5ee6ee1b5", size = 1953896, upload-time = "2025-07-23T11:18:20.572Z" }, -] - [[package]] name = "requests" version = "2.32.4"