Skip to content

release: 1.0.0-alpha.9 #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 @@
{
".": "1.0.0-alpha.8"
".": "1.0.0-alpha.9"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.0.0-alpha.9 (2025-05-10)

Full Changelog: [v1.0.0-alpha.8...v1.0.0-alpha.9](https://github.com/hubmapconsortium/search-python-sdk/compare/v1.0.0-alpha.8...v1.0.0-alpha.9)

### Bug Fixes

* **package:** support direct resource imports ([1a043fa](https://github.com/hubmapconsortium/search-python-sdk/commit/1a043fa679f9d180891f85b7eda0c0330bdb97d7))


### Chores

* **internal:** avoid errors for isinstance checks on proxies ([a5f7277](https://github.com/hubmapconsortium/search-python-sdk/commit/a5f727743444a957c2e3d66c7710392ac169189f))

## 1.0.0-alpha.8 (2025-04-24)

Full Changelog: [v1.0.0-alpha.7...v1.0.0-alpha.8](https://github.com/hubmapconsortium/search-python-sdk/compare/v1.0.0-alpha.7...v1.0.0-alpha.8)
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 = "hubmap_search_sdk"
version = "1.0.0-alpha.8"
version = "1.0.0-alpha.9"
description = "The official Python library for the hubmap-search-sdk API"
dynamic = ["readme"]
license = "MIT"
Expand Down
5 changes: 5 additions & 0 deletions src/hubmap_search_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -78,6 +80,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
Expand Down
5 changes: 4 additions & 1 deletion src/hubmap_search_sdk/_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
24 changes: 24 additions & 0 deletions src/hubmap_search_sdk/_utils/_resources_proxy.py
Original file line number Diff line number Diff line change
@@ -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 `hubmap_search_sdk.resources` module.

This is used so that we can lazily import `hubmap_search_sdk.resources` only when
needed *and* so that users can just import `hubmap_search_sdk` and reference `hubmap_search_sdk.resources`
"""

@override
def __load__(self) -> Any:
import importlib

mod = importlib.import_module("hubmap_search_sdk.resources")
return mod


resources = ResourcesProxy().__as_proxied__()
2 changes: 1 addition & 1 deletion src/hubmap_search_sdk/_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__ = "hubmap_search_sdk"
__version__ = "1.0.0-alpha.8" # x-release-please-version
__version__ = "1.0.0-alpha.9" # 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)