diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4208b5c..ac03171 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.6.0" + ".": "0.6.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 1973072..b8132f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 3 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-bc0272bf0a53ec37ca25f4a8b76bca4b90cf33c5f41816edf460daa642a5a84a.yml -openapi_spec_hash: 79f28fedf89e1b719f464c064847a630 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-a0aa3bcfef3af964f7172cecc6e969193a4ca96b26f8c47e7f50d852b13ef356.yml +openapi_spec_hash: e243aed52e8a3c6dad6254c57408fdc4 config_hash: bfe30148ec88e8bbbf4a348a9fdfc00a diff --git a/CHANGELOG.md b/CHANGELOG.md index c6de71f..a427bf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.6.1 (2025-05-10) + +Full Changelog: [v0.6.0...v0.6.1](https://github.com/isaacus-dev/isaacus-python/compare/v0.6.0...v0.6.1) + +### Bug Fixes + +* **client:** fix bug where types occasionally wouldn't generate ([e1bec40](https://github.com/isaacus-dev/isaacus-python/commit/e1bec4066b30cfefa004cdddc620c4c8131bd0de)) +* **package:** support direct resource imports ([46ada4d](https://github.com/isaacus-dev/isaacus-python/commit/46ada4d158767a9dc03f19222009a853c5626cc7)) + + +### Chores + +* **internal:** avoid errors for isinstance checks on proxies ([e4ffb62](https://github.com/isaacus-dev/isaacus-python/commit/e4ffb62a053ec88a60667a8a1e149a15d5f61a86)) +* **internal:** codegen related update ([ed8951f](https://github.com/isaacus-dev/isaacus-python/commit/ed8951f3943af3be84ea11a363e6ac3c23e37b2b)) + + +### Documentation + +* **api:** fixed incorrect description of how extraction results are ordered ([4c6ee63](https://github.com/isaacus-dev/isaacus-python/commit/4c6ee63ab3b274ee76cb56f526004f2f63dbb0ac)) +* remove or fix invalid readme examples ([71a39ed](https://github.com/isaacus-dev/isaacus-python/commit/71a39ed2e5608d44fec4c1c5d83f97af6eaa4527)) + ## 0.6.0 (2025-04-30) Full Changelog: [v0.5.0...v0.6.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.5.0...v0.6.0) diff --git a/README.md b/README.md index 20666b5..348d853 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ universal_classification = client.classifications.universal.create( "size": 512, }, ) -print(universal_classification.chunking_options) +print(universal_classification.classifications) ``` ## Handling errors diff --git a/pyproject.toml b/pyproject.toml index 84be4f9..86ee003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "isaacus" -version = "0.6.0" +version = "0.6.1" description = "The official Python library for the isaacus API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/isaacus/__init__.py b/src/isaacus/__init__.py index d7689b5..26cbd3d 100644 --- a/src/isaacus/__init__.py +++ b/src/isaacus/__init__.py @@ -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 @@ -68,6 +70,9 @@ "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 diff --git a/src/isaacus/_utils/_proxy.py b/src/isaacus/_utils/_proxy.py index ffd883e..0f239a3 100644 --- a/src/isaacus/_utils/_proxy.py +++ b/src/isaacus/_utils/_proxy.py @@ -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__ diff --git a/src/isaacus/_utils/_resources_proxy.py b/src/isaacus/_utils/_resources_proxy.py new file mode 100644 index 0000000..d988d0e --- /dev/null +++ b/src/isaacus/_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 `isaacus.resources` module. + + This is used so that we can lazily import `isaacus.resources` only when + needed *and* so that users can just import `isaacus` and reference `isaacus.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("isaacus.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/isaacus/_version.py b/src/isaacus/_version.py index 86b8b84..d2e67c5 100644 --- a/src/isaacus/_version.py +++ b/src/isaacus/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "isaacus" -__version__ = "0.6.0" # x-release-please-version +__version__ = "0.6.1" # x-release-please-version diff --git a/src/isaacus/types/extractions/answer_extraction.py b/src/isaacus/types/extractions/answer_extraction.py index 97e546a..28c519c 100644 --- a/src/isaacus/types/extractions/answer_extraction.py +++ b/src/isaacus/types/extractions/answer_extraction.py @@ -61,7 +61,8 @@ class AnswerExtraction(BaseModel): extractions: List[Extraction] """ The results of extracting answers from the texts, ordered from highest to lowest - inextractability score. + answer confidence score (or else lowest to highest inextractability score if + there are no answers for a text). """ usage: Usage diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 6adb5ca..44abbb3 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -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)