diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cce9240..dbe5ddf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.1" + ".": "0.3.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f021c8..ecd8ad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.3.2 (2025-05-13) + +Full Changelog: [v0.3.1...v0.3.2](https://github.com/replicate/replicate-python-stainless/compare/v0.3.1...v0.3.2) + +### Bug Fixes + +* **package:** support direct resource imports ([97b771a](https://github.com/replicate/replicate-python-stainless/commit/97b771a8f2f318e5907656c04ddb6b711af1d44a)) + ## 0.3.1 (2025-05-09) Full Changelog: [v0.3.0...v0.3.1](https://github.com/replicate/replicate-python-stainless/compare/v0.3.0...v0.3.1) diff --git a/pyproject.toml b/pyproject.toml index b2583c2..cfd0231 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "replicate-stainless" -version = "0.3.1" +version = "0.3.2" description = "The official Python library for the replicate API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/replicate/__init__.py b/src/replicate/__init__.py index c0695ad..137a79d 100644 --- a/src/replicate/__init__.py +++ b/src/replicate/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing as _t from typing_extensions import override from . import types @@ -89,6 +90,9 @@ "ModelVersionIdentifier", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/replicate/_utils/_resources_proxy.py b/src/replicate/_utils/_resources_proxy.py new file mode 100644 index 0000000..fcbddde --- /dev/null +++ b/src/replicate/_utils/_resources_proxy.py @@ -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 `replicate.resources` module. + + This is used so that we can lazily import `replicate.resources` only when + needed *and* so that users can just import `replicate` and reference `replicate.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("replicate.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/replicate/_version.py b/src/replicate/_version.py index 6ecc8c0..38842d0 100644 --- a/src/replicate/_version.py +++ b/src/replicate/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "replicate" -__version__ = "0.3.1" # x-release-please-version +__version__ = "0.3.2" # x-release-please-version