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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/miru-platform-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

Expand All @@ -43,10 +43,10 @@ jobs:
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/miru-platform-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

Expand All @@ -61,7 +61,7 @@ jobs:
github.repository == 'stainless-sdks/miru-platform-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

Expand All @@ -81,10 +81,10 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/miru-platform-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.9.13'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.repository == 'mirurobotics/python-platform-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Check release environment
run: |
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.9.0"
".": "0.10.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/miru-ml%2Fmiru-platform-17499bf3c547af4a5621b6681e2bfd3affd3f723f5d093b06dd359e074e2ef11.yml
openapi_spec_hash: 422d94e0e3ad00df785039db896b320f
config_hash: 44dad6a95136246af502e80b91c194b9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/miru-ml/miru-platform-8ef5c42a5e3e5f7c24cabc1a900a5f13ad5b6ff42734bd5dfefa48dec747f6b5.yml
openapi_spec_hash: a5b8a1a51bddbe5a31445253a6effb7b
config_hash: 8bf107cbb3d57e7a1704382e9991502c
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.10.0 (2026-05-13)

Full Changelog: [v0.9.0...v0.10.0](https://github.com/mirurobotics/python-platform-sdk/compare/v0.9.0...v0.10.0)

### Features

* **api:** upgrade to 2026-05-06.rainier-beta.3 ([2dbcc65](https://github.com/mirurobotics/python-platform-sdk/commit/2dbcc652ba6c201d997a87c6bbf9810cb8c5eabb))
* **internal/types:** support eagerly validating pydantic iterators ([1aadc67](https://github.com/mirurobotics/python-platform-sdk/commit/1aadc67a16bd634bbf368f36c28334365e50c4eb))


### Bug Fixes

* **client:** add missing f-string prefix in file type error message ([b21baec](https://github.com/mirurobotics/python-platform-sdk/commit/b21baec899aae9a318d65a0acacb76f76f946c07))


### Chores

* **internal:** reformat pyproject.toml ([bd0e40e](https://github.com/mirurobotics/python-platform-sdk/commit/bd0e40e96fecdfa1a46e4cff6260aadcde3aaf0e))

## 0.9.0 (2026-04-28)

Full Changelog: [v0.8.2...v0.9.0](https://github.com/mirurobotics/python-platform-sdk/compare/v0.8.2...v0.9.0)
Expand Down
22 changes: 14 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,29 @@ Methods:
Types:

```python
from miru_platform_sdk.types import (
Device,
DeviceList,
DeviceIssueActivationTokenResponse,
DevicePingResponse,
)
from miru_platform_sdk.types import Device, DeviceList, DevicePingResponse
```

Methods:

- <code title="post /devices">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">create</a>(\*\*<a href="src/miru_platform_sdk/types/device_create_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device.py">Device</a></code>
- <code title="get /devices/{device_id}">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">retrieve</a>(device_id) -> <a href="./src/miru_platform_sdk/types/device.py">Device</a></code>
- <code title="get /devices/{device_id}">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">retrieve</a>(device_id, \*\*<a href="src/miru_platform_sdk/types/device_retrieve_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device.py">Device</a></code>
- <code title="patch /devices/{device_id}">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">update</a>(device_id, \*\*<a href="src/miru_platform_sdk/types/device_update_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device.py">Device</a></code>
- <code title="get /devices">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">list</a>(\*\*<a href="src/miru_platform_sdk/types/device_list_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device_list.py">DeviceList</a></code>
- <code title="post /devices/{device_id}/activation_token">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">issue_activation_token</a>(device_id, \*\*<a href="src/miru_platform_sdk/types/device_issue_activation_token_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device_issue_activation_token_response.py">DeviceIssueActivationTokenResponse</a></code>
- <code title="post /devices/{device_id}/ping">client.devices.<a href="./src/miru_platform_sdk/resources/devices.py">ping</a>(device_id, \*\*<a href="src/miru_platform_sdk/types/device_ping_params.py">params</a>) -> <a href="./src/miru_platform_sdk/types/device_ping_response.py">DevicePingResponse</a></code>

# ProvisioningTokens

Types:

```python
from miru_platform_sdk.types import ProvisioningToken
```

Methods:

- <code title="post /provisioning_tokens">client.provisioning_tokens.<a href="./src/miru_platform_sdk/resources/provisioning_tokens.py">create</a>() -> <a href="./src/miru_platform_sdk/types/provisioning_token.py">ProvisioningToken</a></code>

# GitCommits

Types:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "miru-platform-sdk"
version = "0.9.0"
version = "0.10.0"
description = "The official Python library for the miru API"
dynamic = ["readme"]
license = "MIT"
Expand Down Expand Up @@ -154,7 +154,7 @@ show_error_codes = true
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ['src/miru_platform_sdk/_files.py', '_dev/.*.py', 'tests/.*']
exclude = ["src/miru_platform_sdk/_files.py", "_dev/.*.py", "tests/.*"]

strict_equality = true
implicit_reexport = true
Expand Down
38 changes: 38 additions & 0 deletions src/miru_platform_sdk/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
config_types,
config_schemas,
config_instances,
provisioning_tokens,
)
from .resources.devices import DevicesResource, AsyncDevicesResource
from .resources.releases import ReleasesResource, AsyncReleasesResource
Expand All @@ -53,6 +54,7 @@
from .resources.config_types import ConfigTypesResource, AsyncConfigTypesResource
from .resources.config_schemas import ConfigSchemasResource, AsyncConfigSchemasResource
from .resources.config_instances import ConfigInstancesResource, AsyncConfigInstancesResource
from .resources.provisioning_tokens import ProvisioningTokensResource, AsyncProvisioningTokensResource

__all__ = [
"ENVIRONMENTS",
Expand Down Expand Up @@ -200,6 +202,12 @@ def devices(self) -> DevicesResource:

return DevicesResource(self)

@cached_property
def provisioning_tokens(self) -> ProvisioningTokensResource:
from .resources.provisioning_tokens import ProvisioningTokensResource

return ProvisioningTokensResource(self)

@cached_property
def git_commits(self) -> GitCommitsResource:
from .resources.git_commits import GitCommitsResource
Expand Down Expand Up @@ -462,6 +470,12 @@ def devices(self) -> AsyncDevicesResource:

return AsyncDevicesResource(self)

@cached_property
def provisioning_tokens(self) -> AsyncProvisioningTokensResource:
from .resources.provisioning_tokens import AsyncProvisioningTokensResource

return AsyncProvisioningTokensResource(self)

@cached_property
def git_commits(self) -> AsyncGitCommitsResource:
from .resources.git_commits import AsyncGitCommitsResource
Expand Down Expand Up @@ -634,6 +648,12 @@ def devices(self) -> devices.DevicesResourceWithRawResponse:

return DevicesResourceWithRawResponse(self._client.devices)

@cached_property
def provisioning_tokens(self) -> provisioning_tokens.ProvisioningTokensResourceWithRawResponse:
from .resources.provisioning_tokens import ProvisioningTokensResourceWithRawResponse

return ProvisioningTokensResourceWithRawResponse(self._client.provisioning_tokens)

@cached_property
def git_commits(self) -> git_commits.GitCommitsResourceWithRawResponse:
from .resources.git_commits import GitCommitsResourceWithRawResponse
Expand Down Expand Up @@ -689,6 +709,12 @@ def devices(self) -> devices.AsyncDevicesResourceWithRawResponse:

return AsyncDevicesResourceWithRawResponse(self._client.devices)

@cached_property
def provisioning_tokens(self) -> provisioning_tokens.AsyncProvisioningTokensResourceWithRawResponse:
from .resources.provisioning_tokens import AsyncProvisioningTokensResourceWithRawResponse

return AsyncProvisioningTokensResourceWithRawResponse(self._client.provisioning_tokens)

@cached_property
def git_commits(self) -> git_commits.AsyncGitCommitsResourceWithRawResponse:
from .resources.git_commits import AsyncGitCommitsResourceWithRawResponse
Expand Down Expand Up @@ -744,6 +770,12 @@ def devices(self) -> devices.DevicesResourceWithStreamingResponse:

return DevicesResourceWithStreamingResponse(self._client.devices)

@cached_property
def provisioning_tokens(self) -> provisioning_tokens.ProvisioningTokensResourceWithStreamingResponse:
from .resources.provisioning_tokens import ProvisioningTokensResourceWithStreamingResponse

return ProvisioningTokensResourceWithStreamingResponse(self._client.provisioning_tokens)

@cached_property
def git_commits(self) -> git_commits.GitCommitsResourceWithStreamingResponse:
from .resources.git_commits import GitCommitsResourceWithStreamingResponse
Expand Down Expand Up @@ -799,6 +831,12 @@ def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse:

return AsyncDevicesResourceWithStreamingResponse(self._client.devices)

@cached_property
def provisioning_tokens(self) -> provisioning_tokens.AsyncProvisioningTokensResourceWithStreamingResponse:
from .resources.provisioning_tokens import AsyncProvisioningTokensResourceWithStreamingResponse

return AsyncProvisioningTokensResourceWithStreamingResponse(self._client.provisioning_tokens)

@cached_property
def git_commits(self) -> git_commits.AsyncGitCommitsResourceWithStreamingResponse:
from .resources.git_commits import AsyncGitCommitsResourceWithStreamingResponse
Expand Down
2 changes: 1 addition & 1 deletion src/miru_platform_sdk/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles
elif is_sequence_t(files):
files = [(key, await _async_transform_file(file)) for key, file in files]
else:
raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")

return files

Expand Down
80 changes: 80 additions & 0 deletions src/miru_platform_sdk/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
ClassVar,
Protocol,
Required,
Annotated,
ParamSpec,
TypeAlias,
TypedDict,
TypeGuard,
final,
Expand Down Expand Up @@ -79,7 +81,15 @@
from ._constants import RAW_RESPONSE_HEADER

if TYPE_CHECKING:
from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
from pydantic_core import CoreSchema, core_schema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
else:
try:
from pydantic_core import CoreSchema, core_schema
except ImportError:
CoreSchema = None
core_schema = None

__all__ = ["BaseModel", "GenericModel"]

Expand Down Expand Up @@ -402,6 +412,76 @@ def model_dump_json(
)


class _EagerIterable(list[_T], Generic[_T]):
"""
Accepts any Iterable[T] input (including generators), consumes it
eagerly, and validates all items upfront.

Validation preserves the original container type where possible
(e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
always emits a list — round-tripping through model_dump() will not
restore the original container type.
"""

@classmethod
def __get_pydantic_core_schema__(
cls,
source_type: Any,
handler: GetCoreSchemaHandler,
) -> CoreSchema:
(item_type,) = get_args(source_type) or (Any,)
item_schema: CoreSchema = handler.generate_schema(item_type)
list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)

return core_schema.no_info_wrap_validator_function(
cls._validate,
list_of_items_schema,
serialization=core_schema.plain_serializer_function_ser_schema(
cls._serialize,
info_arg=False,
),
)

@staticmethod
def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
original_type: type[Any] = type(v)

# Normalize to list so list_schema can validate each item
if isinstance(v, list):
items: list[_T] = v
else:
try:
items = list(v)
except TypeError as e:
raise TypeError("Value is not iterable") from e

# Validate items against the inner schema
validated: list[_T] = handler(items)

# Reconstruct original container type
if original_type is list:
return validated
# str(list) produces the list's repr, not a string built from items,
# so skip reconstruction for str and its subclasses.
if issubclass(original_type, str):
return validated
try:
return original_type(validated)
except (TypeError, ValueError):
# If the type cannot be reconstructed, just return the validated list
return validated

@staticmethod
def _serialize(v: Iterable[_T]) -> list[_T]:
"""Always serialize as a list so Pydantic's JSON encoder is happy."""
if isinstance(v, list):
return v
return list(v)


EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]


def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if value is None:
return field_get_default(field)
Expand Down
2 changes: 1 addition & 1 deletion src/miru_platform_sdk/_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__ = "miru_platform_sdk"
__version__ = "0.9.0" # x-release-please-version
__version__ = "0.10.0" # x-release-please-version
Loading
Loading