mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-05 10:23:44 +00:00
refactor: enforce top-level imports for llama-stack-api
Enforce that all imports from llama-stack-api use the form: from llama_stack_api import <symbol> This prevents external code from accessing internal package structure (e.g., llama_stack_api.agents, llama_stack_api.common.*) and establishes a clear public API boundary. Changes: - Export 400+ symbols from llama_stack_api/__init__.py - Include all API types, common utilities, and strong_typing helpers - Update files across src/llama_stack, docs/, tests/, scripts/ - Convert all submodule imports to top-level imports - ensure docs use the proper importing structure Addresses PR review feedback requiring explicit __all__ definition to prevent "peeking inside" the API package. Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
b7480e9c88
commit
2e5d1c8881
270 changed files with 1587 additions and 750 deletions
|
|
@ -8,8 +8,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
from botocore.exceptions import ClientError
|
||||
from llama_stack_api.common.errors import ResourceNotFoundError
|
||||
from llama_stack_api.files import OpenAIFilePurpose
|
||||
from llama_stack_api import OpenAIFilePurpose, ResourceNotFoundError
|
||||
|
||||
|
||||
class TestS3FilesImpl:
|
||||
|
|
@ -227,7 +226,7 @@ class TestS3FilesImpl:
|
|||
|
||||
mock_now.return_value = 0
|
||||
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
sample_text_file.filename = "test_expired_file"
|
||||
uploaded = await s3_provider.openai_upload_file(
|
||||
|
|
@ -259,7 +258,7 @@ class TestS3FilesImpl:
|
|||
|
||||
async def test_unsupported_expires_after_anchor(self, s3_provider, sample_text_file):
|
||||
"""Unsupported anchor value should raise ValueError."""
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
sample_text_file.filename = "test_unsupported_expires_after_anchor"
|
||||
|
||||
|
|
@ -272,7 +271,7 @@ class TestS3FilesImpl:
|
|||
|
||||
async def test_nonint_expires_after_seconds(self, s3_provider, sample_text_file):
|
||||
"""Non-integer seconds in expires_after should raise ValueError."""
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
sample_text_file.filename = "test_nonint_expires_after_seconds"
|
||||
|
||||
|
|
@ -285,7 +284,7 @@ class TestS3FilesImpl:
|
|||
|
||||
async def test_expires_after_seconds_out_of_bounds(self, s3_provider, sample_text_file):
|
||||
"""Seconds outside allowed range should raise ValueError."""
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
with pytest.raises(ValueError, match="greater than or equal to 3600"):
|
||||
await s3_provider.openai_upload_file(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue