fix(package): support direct resource imports

This commit is contained in:
stainless-app[bot]
2025-05-10 03:52:45 +00:00
parent 4c70fe82b3
commit 68773c05f0
2 changed files with 29 additions and 0 deletions
+5
View File
@@ -1,5 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import typing as _t
from . import types
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
@@ -80,6 +82,9 @@ __all__ = [
"DefaultAsyncHttpxClient",
]
if not _t.TYPE_CHECKING:
from ._utils._resources_proxy import resources as resources
_setup_logging()
# Update the __module__ attribute for exported symbols so that
+24
View File
@@ -0,0 +1,24 @@
from __future__ import annotations
from typing import Any
from typing_extensions import override
from ._proxy import LazyProxy
class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `hanzoai.resources` module.
This is used so that we can lazily import `hanzoai.resources` only when
needed *and* so that users can just import `hanzoai` and reference `hanzoai.resources`
"""
@override
def __load__(self) -> Any:
import importlib
mod = importlib.import_module("hanzoai.resources")
return mod
resources = ResourcesProxy().__as_proxied__()