Skip to content

release: 1.3.0 #122

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

Merged
merged 33 commits into from
May 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
862cd7e
chore(internal): update client tests (#121)
stainless-app[bot] Feb 13, 2025
c8b2cd7
fix: asyncify on non-asyncio runtimes (#123)
stainless-app[bot] Feb 14, 2025
0678102
chore(internal): codegen related update (#124)
stainless-app[bot] Feb 19, 2025
6cdee1b
feat(client): allow passing `NotGiven` for body (#125)
stainless-app[bot] Feb 21, 2025
eaf577b
chore(internal): fix devcontainers setup (#126)
stainless-app[bot] Feb 22, 2025
5236106
chore(internal): properly set __pydantic_private__ (#127)
stainless-app[bot] Feb 26, 2025
5e2932f
docs: update URLs from stainlessapi.com to stainless.com (#128)
stainless-app[bot] Feb 28, 2025
b2201f1
chore(docs): update client docstring (#129)
stainless-app[bot] Feb 28, 2025
c63a3bd
chore(internal): remove unused http client options forwarding (#130)
stainless-app[bot] Mar 4, 2025
1be828d
feat(api): api update (#131)
stainless-app[bot] Mar 10, 2025
3248d7e
chore(internal): codegen related update (#132)
stainless-app[bot] Mar 12, 2025
2a08d98
feat(api): api update (#133)
stainless-app[bot] Mar 12, 2025
2206050
chore(internal): remove extra empty newlines (#134)
stainless-app[bot] Mar 14, 2025
9aeac01
chore(internal): bump rye to 0.44.0 (#136)
stainless-app[bot] Mar 15, 2025
d9e09e3
fix(types): handle more discriminated union shapes (#137)
stainless-app[bot] Mar 15, 2025
173fdde
fix(ci): ensure pip is always available (#138)
stainless-app[bot] Mar 17, 2025
bd66d56
fix(ci): remove publishing patch (#139)
stainless-app[bot] Mar 17, 2025
5846086
codegen metadata
stainless-app[bot] Mar 20, 2025
134049e
feat(api): api update (#140)
stainless-app[bot] Mar 20, 2025
145e5cb
feat(api): api update (#141)
stainless-app[bot] Mar 21, 2025
0157632
chore: fix typos (#142)
stainless-app[bot] Mar 27, 2025
edf2a8e
codegen metadata
stainless-app[bot] Mar 27, 2025
d55e411
feat(api): api update (#143)
stainless-app[bot] Apr 1, 2025
2b055d7
chore(internal): remove trailing character (#145)
stainless-app[bot] Apr 4, 2025
2d46582
chore(internal): slight transform perf improvement (#147)
stainless-app[bot] Apr 9, 2025
c40603c
chore: slight wording improvement in README (#148)
stainless-app[bot] Apr 9, 2025
4494839
chore(internal): expand CI branch coverage
stainless-app[bot] Apr 10, 2025
1bd4d8b
chore(internal): reduce CI branch coverage
stainless-app[bot] Apr 10, 2025
5cc6c58
fix(perf): skip traversing types for NotGiven values
stainless-app[bot] Apr 12, 2025
042f048
fix(perf): optimize some hot paths
stainless-app[bot] Apr 12, 2025
0f0e110
chore(internal): update pyright settings
stainless-app[bot] Apr 15, 2025
47df6f5
chore(client): minor internal fixes
stainless-app[bot] Apr 15, 2025
9b569fe
release: 1.3.0
stainless-app[bot] Apr 15, 2025
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
Prev Previous commit
Next Next commit
fix: asyncify on non-asyncio runtimes (#123)
  • Loading branch information
stainless-app[bot] committed Feb 14, 2025
commit c8b2cd77f4cb07d06a00a09cac3eaa55cf6c6925
19 changes: 17 additions & 2 deletions src/browserbase/_utils/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec

import anyio
import sniffio
import anyio.to_thread

T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec")


if sys.version_info >= (3, 9):
to_thread = asyncio.to_thread
_asyncio_to_thread = asyncio.to_thread
else:
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
# for Python 3.8 support
async def to_thread(
async def _asyncio_to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> Any:
"""Asynchronously run function *func* in a separate thread.
Expand All @@ -34,6 +38,17 @@ async def to_thread(
return await loop.run_in_executor(None, func_call)


async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
return await _asyncio_to_thread(func, *args, **kwargs)

return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
)


# inspired by `asyncer`, https://github.com/tiangolo/asyncer
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
Expand Down
Loading