Skip to content
Merged
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
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'preview-head/**'
- 'preview-base/**'
- 'preview/**'
branches:
- main
pull_request:
branches:
- main
- next

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.90.0"
".": "0.90.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.90.1 (2025-04-11)

Full Changelog: [v0.90.0...v0.90.1](https://github.com/lithic-com/lithic-python/compare/v0.90.0...v0.90.1)

### Bug Fixes

* **perf:** skip traversing types for NotGiven values ([5c6a919](https://github.com/lithic-com/lithic-python/commit/5c6a9196fab4c1cfcfdc64689088570df57c2245))


### Chores

* **internal:** reduce CI branch coverage ([cf29bc0](https://github.com/lithic-com/lithic-python/commit/cf29bc098038e00d1a332b156cc1b192e0b1cad1))

## 0.90.0 (2025-04-09)

Full Changelog: [v0.89.0...v0.90.0](https://github.com/lithic-com/lithic-python/compare/v0.89.0...v0.90.0)
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 = "lithic"
version = "0.90.0"
version = "0.90.1"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
11 changes: 11 additions & 0 deletions src/lithic/_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
2 changes: 1 addition & 1 deletion src/lithic/_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__ = "lithic"
__version__ = "0.90.0" # x-release-please-version
__version__ = "0.90.1" # x-release-please-version
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 lithic._types import Base64FileInput
from lithic._types import NOT_GIVEN, Base64FileInput
from lithic._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) == {}