Skip to content

release: 0.3.0 #62

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 45 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f8a2a44
feat(api): manual updates (#61)
stainless-app[bot] Feb 19, 2025
a422668
codegen metadata
stainless-app[bot] Feb 20, 2025
a62be8a
feat(client): allow passing `NotGiven` for body (#63)
stainless-app[bot] Feb 21, 2025
f29b9ba
feat(api): manual updates (#64)
stainless-app[bot] Feb 21, 2025
ce1db49
chore(internal): properly set __pydantic_private__ (#66)
stainless-app[bot] Feb 26, 2025
cfce519
docs: update URLs from stainlessapi.com to stainless.com (#67)
stainless-app[bot] Feb 28, 2025
65a92c5
chore(docs): update client docstring (#68)
stainless-app[bot] Feb 28, 2025
69a6bde
chore(internal): remove unused http client options forwarding (#69)
stainless-app[bot] Mar 4, 2025
317e72c
chore(internal): codegen related update (#70)
stainless-app[bot] Mar 11, 2025
5166c0c
chore(internal): remove extra empty newlines (#71)
stainless-app[bot] Mar 14, 2025
a8f27cc
chore(internal): codegen related update (#72)
stainless-app[bot] Mar 15, 2025
64be852
chore(internal): bump rye to 0.44.0 (#73)
stainless-app[bot] Mar 15, 2025
e2efe2b
fix(types): handle more discriminated union shapes (#74)
stainless-app[bot] Mar 15, 2025
2a3ae1d
fix(ci): ensure pip is always available (#75)
stainless-app[bot] Mar 17, 2025
fc6ffe9
fix(ci): remove publishing patch (#76)
stainless-app[bot] Mar 17, 2025
ad69954
chore: fix typos (#77)
stainless-app[bot] Mar 27, 2025
1240746
codegen metadata
stainless-app[bot] Mar 27, 2025
140ac8b
chore(internal): remove trailing character (#78)
stainless-app[bot] Apr 4, 2025
7de371c
chore(internal): variable name and test updates (#79)
stainless-app[bot] Apr 4, 2025
62166e9
chore(internal): slight transform perf improvement (#80)
stainless-app[bot] Apr 9, 2025
7b5fc94
chore(tests): improve enum examples (#81)
stainless-app[bot] Apr 9, 2025
c99fbf1
chore(internal): expand CI branch coverage
stainless-app[bot] Apr 10, 2025
f9fb625
chore(internal): reduce CI branch coverage
stainless-app[bot] Apr 10, 2025
655645b
fix(perf): skip traversing types for NotGiven values
stainless-app[bot] Apr 12, 2025
4a25116
fix(perf): optimize some hot paths
stainless-app[bot] Apr 12, 2025
d924d39
chore(internal): update pyright settings
stainless-app[bot] Apr 15, 2025
48341b1
chore(client): minor internal fixes
stainless-app[bot] Apr 15, 2025
9073aa6
chore(internal): bump pyright version
stainless-app[bot] Jun 6, 2025
4615096
chore(internal): base client updates
stainless-app[bot] Apr 17, 2025
55f3b64
chore(internal): update models test
stainless-app[bot] Apr 19, 2025
9112f34
chore(ci): add timeout thresholds for CI jobs
stainless-app[bot] Apr 23, 2025
702e260
chore(internal): import reformatting
stainless-app[bot] Apr 23, 2025
4a852b4
chore(internal): fix list file params
stainless-app[bot] Apr 23, 2025
fba2a60
chore(internal): refactor retries to not use recursion
stainless-app[bot] Apr 23, 2025
6b28a69
fix(pydantic v1): more robust ModelField.annotation check
stainless-app[bot] Apr 23, 2025
759ff42
chore(internal): minor formatting changes
stainless-app[bot] Apr 24, 2025
0067daf
chore(internal): codegen related update
stainless-app[bot] Apr 24, 2025
e00a169
chore(ci): only use depot for staging repos
stainless-app[bot] Apr 24, 2025
a4e4e7a
chore: broadly detect json family of content-type headers
stainless-app[bot] Apr 24, 2025
416c2ef
feat(api): manual updates
stainless-app[bot] May 7, 2025
2717e93
feat(api): manual updates
stainless-app[bot] May 9, 2025
530d80c
feat(api): manual updates
stainless-app[bot] May 9, 2025
72320f5
feat(api): manual updates
stainless-app[bot] Jun 3, 2025
640479a
feat(api): manual updates
stainless-app[bot] Jun 6, 2025
2510cb9
release: 0.3.0
stainless-app[bot] Jun 6, 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
chore(internal): slight transform perf improvement (#80)
  • Loading branch information
stainless-app[bot] committed Apr 9, 2025
commit 62166e9543adfd3ab32fb403c9ab3a26b767f618
22 changes: 22 additions & 0 deletions src/gitpod/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
return key


def _no_transform_needed(annotation: type) -> bool:
return annotation == float or annotation == int


def _transform_recursive(
data: object,
*,
Expand Down Expand Up @@ -184,6 +188,15 @@ def _transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down Expand Up @@ -332,6 +345,15 @@ async def _async_transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,15 @@ async def test_base64_file_input(use_async: bool) -> None:
assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == {
"foo": "SGVsbG8sIHdvcmxkIQ=="
} # type: ignore[comparison-overlap]


@parametrize
@pytest.mark.asyncio
async def test_transform_skipping(use_async: bool) -> None:
# lists of ints are left as-is
data = [1, 2, 3]
assert await transform(data, List[int], use_async) is data

# iterables of ints are converted to a list
data = iter([1, 2, 3])
assert await transform(data, Iterable[int], use_async) == [1, 2, 3]