Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.3.0"
".": "0.3.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 35
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-88cf5fe1f5accb56ae9fbb31c0df00d1552762d4c558d16d8547894ae95e8ccb.yml
openapi_spec_hash: 43283d20f335a04241cce165452ff50e
config_hash: 84794ed69d841684ff08a8aa889ef103
config_hash: 8e356248f15e5e54d2aecab141f45228
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 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)

### Chores

* **internal:** avoid errors for isinstance checks on proxies ([b31e651](https://github.com/replicate/replicate-python-stainless/commit/b31e651903235d70ea0f3b03aac56de9320996bf))

## 0.3.0 (2025-05-08)

Full Changelog: [v0.2.1...v0.3.0](https://github.com/replicate/replicate-python-stainless/compare/v0.2.1...v0.3.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "replicate-stainless"
version = "0.3.0"
version = "0.3.1"
description = "The official Python library for the replicate API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 4 additions & 1 deletion src/replicate/_utils/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
@property # type: ignore
@override
def __class__(self) -> type: # pyright: ignore
proxied = self.__get_proxied__()
try:
proxied = self.__get_proxied__()
except Exception:
return type(self)
if issubclass(type(proxied), LazyProxy):
return type(proxied)
return proxied.__class__
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "replicate"
__version__ = "0.3.0" # x-release-please-version
__version__ = "0.3.1" # x-release-please-version
11 changes: 11 additions & 0 deletions tests/test_utils/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ def test_recursive_proxy() -> None:
assert dir(proxy) == []
assert type(proxy).__name__ == "RecursiveLazyProxy"
assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy"


def test_isinstance_does_not_error() -> None:
class AlwaysErrorProxy(LazyProxy[Any]):
@override
def __load__(self) -> Any:
raise RuntimeError("Mocking missing dependency")

proxy = AlwaysErrorProxy()
assert not isinstance(proxy, dict)
assert isinstance(proxy, LazyProxy)