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
Show file tree
Hide file tree
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(perf): skip traversing types for NotGiven values
  • Loading branch information
stainless-app[bot] committed Apr 12, 2025
commit 5cc6c58561556e2b50fccbeed5e123adf3aba72d
11 changes: 11 additions & 0 deletions src/browserbase/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from ._utils import (
is_list,
is_given,
is_mapping,
is_iterable,
)
Expand Down Expand Up @@ -258,6 +259,11 @@ def _transform_typeddict(
result: dict[str, object] = {}
annotations = get_type_hints(expected_type, include_extras=True)
for key, value in data.items():
if not is_given(value):
# we don't need to include `NotGiven` values here as they'll
# be stripped out before the request is sent anyway
continue

type_ = annotations.get(key)
if type_ is None:
# we do not have a type annotation for this field, leave it as is
Expand Down Expand Up @@ -415,6 +421,11 @@ async def _async_transform_typeddict(
result: dict[str, object] = {}
annotations = get_type_hints(expected_type, include_extras=True)
for key, value in data.items():
if not is_given(value):
# we don't need to include `NotGiven` values here as they'll
# be stripped out before the request is sent anyway
continue

type_ = annotations.get(key)
if type_ is None:
# we do not have a type annotation for this field, leave it as is
Expand Down
9 changes: 8 additions & 1 deletion tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pytest

from browserbase._types import Base64FileInput
from browserbase._types import NOT_GIVEN, Base64FileInput
from browserbase._utils import (
PropertyInfo,
transform as _transform,
Expand Down Expand Up @@ -444,3 +444,10 @@ async def test_transform_skipping(use_async: bool) -> None:
# iterables of ints are converted to a list
data = iter([1, 2, 3])
assert await transform(data, Iterable[int], use_async) == [1, 2, 3]


@parametrize
@pytest.mark.asyncio
async def test_strips_notgiven(use_async: bool) -> None:
assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"}
assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {}
Loading