Skip to content

Commit d5939e4

Browse files
authored
Merge pull request #173 from lumalabs/release-please--branches--main--changes--next
release: 1.17.2
2 parents fd6f90b + b26b387 commit d5939e4

File tree

10 files changed

+75
-8
lines changed

10 files changed

+75
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
run: ./scripts/lint
3737

3838
build:
39-
if: github.repository == 'stainless-sdks/luma_ai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
39+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
4040
timeout-minutes: 10
4141
name: build
4242
permissions:
4343
contents: read
4444
id-token: write
45-
runs-on: depot-ubuntu-24.04
45+
runs-on: ${{ github.repository == 'stainless-sdks/luma_ai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4646
steps:
4747
- uses: actions/checkout@v4
4848

@@ -61,12 +61,14 @@ jobs:
6161
run: rye build
6262

6363
- name: Get GitHub OIDC Token
64+
if: github.repository == 'stainless-sdks/luma_ai-python'
6465
id: github-oidc
6566
uses: actions/github-script@v6
6667
with:
6768
script: core.setOutput('github_token', await core.getIDToken());
6869

6970
- name: Upload tarball
71+
if: github.repository == 'stainless-sdks/luma_ai-python'
7072
env:
7173
URL: https://pkg.stainless.com/s
7274
AUTH: ${{ steps.github-oidc.outputs.github_token }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.17.1"
2+
".": "1.17.2"
33
}

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 1.17.2 (2025-08-30)
4+
5+
Full Changelog: [v1.17.1...v1.17.2](https://github.com/lumalabs/lumaai-python/compare/v1.17.1...v1.17.2)
6+
7+
### Bug Fixes
8+
9+
* avoid newer type syntax ([4c7e849](https://github.com/lumalabs/lumaai-python/commit/4c7e849ff9b0efbabba24aab8f4c3ad182756940))
10+
11+
12+
### Chores
13+
14+
* **internal:** add Sequence related utils ([dc85243](https://github.com/lumalabs/lumaai-python/commit/dc8524308fe02225a82c0ef9ad3b424920e416e4))
15+
* **internal:** change ci workflow machines ([eb1b9a6](https://github.com/lumalabs/lumaai-python/commit/eb1b9a6fb577b0577fc812d68d1d96cd38d3f3d1))
16+
* **internal:** update pyright exclude list ([413b33b](https://github.com/lumalabs/lumaai-python/commit/413b33b4a4805b1e45a8986e05ab7800ca08d277))
17+
* update github action ([e4e2029](https://github.com/lumalabs/lumaai-python/commit/e4e20297f21e3e87806939216aff01803f387d19))
18+
319
## 1.17.1 (2025-08-14)
420

521
Full Changelog: [v1.17.0...v1.17.1](https://github.com/lumalabs/lumaai-python/compare/v1.17.0...v1.17.1)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "lumaai"
3-
version = "1.17.1"
3+
version = "1.17.2"
44
description = "The official Python library for the lumaai API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -148,6 +148,7 @@ exclude = [
148148
"_dev",
149149
".venv",
150150
".nox",
151+
".git",
151152
]
152153

153154
reportImplicitOverride = true

src/lumaai/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def model_dump(
304304
exclude_none=exclude_none,
305305
)
306306

307-
return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
307+
return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped
308308

309309
@override
310310
def model_dump_json(

src/lumaai/_types.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,21 @@
1313
Mapping,
1414
TypeVar,
1515
Callable,
16+
Iterator,
1617
Optional,
1718
Sequence,
1819
)
19-
from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
20+
from typing_extensions import (
21+
Set,
22+
Literal,
23+
Protocol,
24+
TypeAlias,
25+
TypedDict,
26+
SupportsIndex,
27+
overload,
28+
override,
29+
runtime_checkable,
30+
)
2031

2132
import httpx
2233
import pydantic
@@ -217,3 +228,26 @@ class _GenericAlias(Protocol):
217228
class HttpxSendArgs(TypedDict, total=False):
218229
auth: httpx.Auth
219230
follow_redirects: bool
231+
232+
233+
_T_co = TypeVar("_T_co", covariant=True)
234+
235+
236+
if TYPE_CHECKING:
237+
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
238+
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
239+
class SequenceNotStr(Protocol[_T_co]):
240+
@overload
241+
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
242+
@overload
243+
def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
244+
def __contains__(self, value: object, /) -> bool: ...
245+
def __len__(self) -> int: ...
246+
def __iter__(self) -> Iterator[_T_co]: ...
247+
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
248+
def count(self, value: Any, /) -> int: ...
249+
def __reversed__(self) -> Iterator[_T_co]: ...
250+
else:
251+
# just point this to a normal `Sequence` at runtime to avoid having to special case
252+
# deserializing our custom sequence type
253+
SequenceNotStr = Sequence

src/lumaai/_utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
extract_type_arg as extract_type_arg,
3939
is_iterable_type as is_iterable_type,
4040
is_required_type as is_required_type,
41+
is_sequence_type as is_sequence_type,
4142
is_annotated_type as is_annotated_type,
4243
is_type_alias_type as is_type_alias_type,
4344
strip_annotated_type as strip_annotated_type,

src/lumaai/_utils/_typing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
2626
return (get_origin(typ) or typ) == list
2727

2828

29+
def is_sequence_type(typ: type) -> bool:
30+
origin = get_origin(typ) or typ
31+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
32+
33+
2934
def is_iterable_type(typ: type) -> bool:
3035
"""If the given type is `typing.Iterable[T]`"""
3136
origin = get_origin(typ) or typ

src/lumaai/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "lumaai"
4-
__version__ = "1.17.1" # x-release-please-version
4+
__version__ = "1.17.2" # x-release-please-version

tests/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import inspect
55
import traceback
66
import contextlib
7-
from typing import Any, TypeVar, Iterator, cast
7+
from typing import Any, TypeVar, Iterator, Sequence, cast
88
from datetime import date, datetime
99
from typing_extensions import Literal, get_args, get_origin, assert_type
1010

@@ -15,6 +15,7 @@
1515
is_list_type,
1616
is_union_type,
1717
extract_type_arg,
18+
is_sequence_type,
1819
is_annotated_type,
1920
is_type_alias_type,
2021
)
@@ -71,6 +72,13 @@ def assert_matches_type(
7172
if is_list_type(type_):
7273
return _assert_list_type(type_, value)
7374

75+
if is_sequence_type(type_):
76+
assert isinstance(value, Sequence)
77+
inner_type = get_args(type_)[0]
78+
for entry in value: # type: ignore
79+
assert_type(inner_type, entry) # type: ignore
80+
return
81+
7482
if origin == str:
7583
assert isinstance(value, str)
7684
elif origin == int:

0 commit comments

Comments
 (0)