From e4e20297f21e3e87806939216aff01803f387d19 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 06:21:52 +0000 Subject: [PATCH 1/6] chore: update github action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59f2288..fe5324d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/luma_ai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: @@ -61,12 +61,14 @@ jobs: run: rye build - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/luma_ai-python' id: github-oidc uses: actions/github-script@v6 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball + if: github.repository == 'stainless-sdks/luma_ai-python' env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From eb1b9a6fb577b0577fc812d68d1d96cd38d3f3d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 05:02:15 +0000 Subject: [PATCH 2/6] chore(internal): change ci workflow machines --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe5324d..3e98af6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: permissions: contents: read id-token: write - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/luma_ai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From 4c7e849ff9b0efbabba24aab8f4c3ad182756940 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 07:14:31 +0000 Subject: [PATCH 3/6] fix: avoid newer type syntax --- src/lumaai/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lumaai/_models.py b/src/lumaai/_models.py index b8387ce..92f7c10 100644 --- a/src/lumaai/_models.py +++ b/src/lumaai/_models.py @@ -304,7 +304,7 @@ def model_dump( exclude_none=exclude_none, ) - return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped @override def model_dump_json( From 413b33b4a4805b1e45a8986e05ab7800ca08d277 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 07:19:42 +0000 Subject: [PATCH 4/6] chore(internal): update pyright exclude list --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7b95411..3b17aa7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,6 +148,7 @@ exclude = [ "_dev", ".venv", ".nox", + ".git", ] reportImplicitOverride = true From dc8524308fe02225a82c0ef9ad3b424920e416e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 03:55:14 +0000 Subject: [PATCH 5/6] chore(internal): add Sequence related utils --- src/lumaai/_types.py | 36 ++++++++++++++++++++++++++++++++++- src/lumaai/_utils/__init__.py | 1 + src/lumaai/_utils/_typing.py | 5 +++++ tests/utils.py | 10 +++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/lumaai/_types.py b/src/lumaai/_types.py index 6a5ac3d..cccee20 100644 --- a/src/lumaai/_types.py +++ b/src/lumaai/_types.py @@ -13,10 +13,21 @@ Mapping, TypeVar, Callable, + Iterator, Optional, Sequence, ) -from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, +) import httpx import pydantic @@ -217,3 +228,26 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... + def __contains__(self, value: object, /) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T_co]: ... + def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... + def count(self, value: Any, /) -> int: ... + def __reversed__(self) -> Iterator[_T_co]: ... +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/lumaai/_utils/__init__.py b/src/lumaai/_utils/__init__.py index d4fda26..ca547ce 100644 --- a/src/lumaai/_utils/__init__.py +++ b/src/lumaai/_utils/__init__.py @@ -38,6 +38,7 @@ extract_type_arg as extract_type_arg, is_iterable_type as is_iterable_type, is_required_type as is_required_type, + is_sequence_type as is_sequence_type, is_annotated_type as is_annotated_type, is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, diff --git a/src/lumaai/_utils/_typing.py b/src/lumaai/_utils/_typing.py index 1bac954..845cd6b 100644 --- a/src/lumaai/_utils/_typing.py +++ b/src/lumaai/_utils/_typing.py @@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool: return (get_origin(typ) or typ) == list +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + def is_iterable_type(typ: type) -> bool: """If the given type is `typing.Iterable[T]`""" origin = get_origin(typ) or typ diff --git a/tests/utils.py b/tests/utils.py index ad3956a..c93c1a9 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,7 +4,7 @@ import inspect import traceback import contextlib -from typing import Any, TypeVar, Iterator, cast +from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type @@ -15,6 +15,7 @@ is_list_type, is_union_type, extract_type_arg, + is_sequence_type, is_annotated_type, is_type_alias_type, ) @@ -71,6 +72,13 @@ def assert_matches_type( if is_list_type(type_): return _assert_list_type(type_, value) + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + if origin == str: assert isinstance(value, str) elif origin == int: From b26b38757429966285990ba63016d538f5f717c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 03:55:32 +0000 Subject: [PATCH 6/6] release: 1.17.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ pyproject.toml | 2 +- src/lumaai/_version.py | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3741b31..953c033 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.1" + ".": "1.17.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b9276..bb05e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 1.17.2 (2025-08-30) + +Full Changelog: [v1.17.1...v1.17.2](https://github.com/lumalabs/lumaai-python/compare/v1.17.1...v1.17.2) + +### Bug Fixes + +* avoid newer type syntax ([4c7e849](https://github.com/lumalabs/lumaai-python/commit/4c7e849ff9b0efbabba24aab8f4c3ad182756940)) + + +### Chores + +* **internal:** add Sequence related utils ([dc85243](https://github.com/lumalabs/lumaai-python/commit/dc8524308fe02225a82c0ef9ad3b424920e416e4)) +* **internal:** change ci workflow machines ([eb1b9a6](https://github.com/lumalabs/lumaai-python/commit/eb1b9a6fb577b0577fc812d68d1d96cd38d3f3d1)) +* **internal:** update pyright exclude list ([413b33b](https://github.com/lumalabs/lumaai-python/commit/413b33b4a4805b1e45a8986e05ab7800ca08d277)) +* update github action ([e4e2029](https://github.com/lumalabs/lumaai-python/commit/e4e20297f21e3e87806939216aff01803f387d19)) + ## 1.17.1 (2025-08-14) Full Changelog: [v1.17.0...v1.17.1](https://github.com/lumalabs/lumaai-python/compare/v1.17.0...v1.17.1) diff --git a/pyproject.toml b/pyproject.toml index 3b17aa7..0103354 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lumaai" -version = "1.17.1" +version = "1.17.2" description = "The official Python library for the lumaai API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/lumaai/_version.py b/src/lumaai/_version.py index e0c8218..05fd62c 100644 --- a/src/lumaai/_version.py +++ b/src/lumaai/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "lumaai" -__version__ = "1.17.1" # x-release-please-version +__version__ = "1.17.2" # x-release-please-version