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
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.30.0"
".": "0.31.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 79
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-59d51521fb27127ec00a91d37d9cbaa484577dbd200d290e61c9d69d33b3c760.yml
openapi_spec_hash: 4ad68555fc0ec3e969817bebff620e88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-29770148092f0f5030e7199308862afc7e46cb12da6081cd045e9db6734d3ac9.yml
openapi_spec_hash: b100a6769bf25a0f873ef32201eba45e
config_hash: 4cb90c87fb61338e46c50cea9c42abd7
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.31.0 (2025-04-21)

Full Changelog: [v0.30.0...v0.31.0](https://github.com/runloopai/api-client-python/compare/v0.30.0...v0.31.0)

### Features

* **api:** api update ([4c348b6](https://github.com/runloopai/api-client-python/commit/4c348b65cf8e0c59b1cc04122a2a53bc863e053b))


### Chores

* **internal:** base client updates ([71a0a00](https://github.com/runloopai/api-client-python/commit/71a0a00703668b365cce28979bf052d2c1ce78a9))
* **internal:** bump pyright version ([950fe0d](https://github.com/runloopai/api-client-python/commit/950fe0d00ec77063e2a8b7dedba256e2878c41bb))
* **internal:** update models test ([def3490](https://github.com/runloopai/api-client-python/commit/def3490573a3b1b304287b54e30cd26fd86dc1ac))

## 0.30.0 (2025-04-16)

Full Changelog: [v0.29.0...v0.30.0](https://github.com/runloopai/api-client-python/compare/v0.29.0...v0.30.0)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ devbox_view = client.devboxes.create(
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
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 = "runloop_api_client"
version = "0.30.0"
version = "0.31.0"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down Expand Up @@ -42,7 +42,7 @@ Repository = "https://github.com/runloopai/api-client-python"
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright>=1.1.359",
"pyright==1.1.399",
"mypy",
"respx",
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.392.post0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
31 changes: 30 additions & 1 deletion src/runloop_api_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@
_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any])

if TYPE_CHECKING:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
from httpx._config import (
DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage]
)

HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG
else:
try:
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
Expand All @@ -115,6 +119,7 @@ class PageInfo:

url: URL | NotGiven
params: Query | NotGiven
json: Body | NotGiven

@overload
def __init__(
Expand All @@ -130,19 +135,30 @@ def __init__(
params: Query,
) -> None: ...

@overload
def __init__(
self,
*,
json: Body,
) -> None: ...

def __init__(
self,
*,
url: URL | NotGiven = NOT_GIVEN,
json: Body | NotGiven = NOT_GIVEN,
params: Query | NotGiven = NOT_GIVEN,
) -> None:
self.url = url
self.json = json
self.params = params

@override
def __repr__(self) -> str:
if self.url:
return f"{self.__class__.__name__}(url={self.url})"
if self.json:
return f"{self.__class__.__name__}(json={self.json})"
return f"{self.__class__.__name__}(params={self.params})"


Expand Down Expand Up @@ -191,6 +207,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions:
options.url = str(url)
return options

if not isinstance(info.json, NotGiven):
if not is_mapping(info.json):
raise TypeError("Pagination is only supported with mappings")

if not options.json_data:
options.json_data = {**info.json}
else:
if not is_mapping(options.json_data):
raise TypeError("Pagination is only supported with mappings")

options.json_data = {**options.json_data, **info.json}
return options

raise ValueError("Unexpected PageInfo state")


Expand Down
1 change: 0 additions & 1 deletion src/runloop_api_client/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
)

import pydantic
import pydantic.generics
from pydantic.fields import FieldInfo

from ._types import (
Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/_utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MyResponse(Foo[_T]):
```
"""
cls = cast(object, get_origin(typ) or typ)
if cls in generic_bases:
if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains]
# we're given the class directly
return extract_type_arg(typ, index)

Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/_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__ = "runloop_api_client"
__version__ = "0.30.0" # x-release-please-version
__version__ = "0.31.0" # x-release-please-version
3 changes: 3 additions & 0 deletions src/runloop_api_client/types/shared/launch_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class LaunchParameters(BaseModel):
If after_idle is set, Devbox will ignore keep_alive_time_seconds.
"""

architecture: Optional[Literal["x86_64", "arm64"]] = None
"""The target architecture for the Devbox. If unset, defaults to arm64."""

available_ports: Optional[List[int]] = None
"""A list of ports to make available on the Devbox.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class LaunchParameters(TypedDict, total=False):
If after_idle is set, Devbox will ignore keep_alive_time_seconds.
"""

architecture: Optional[Literal["x86_64", "arm64"]]
"""The target architecture for the Devbox. If unset, defaults to arm64."""

available_ports: Optional[Iterable[int]]
"""A list of ports to make available on the Devbox.

Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/scenarios/test_scorers.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def test_method_validate_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -418,6 +419,7 @@ async def test_method_validate_with_all_params(self, async_client: AsyncRunloop)
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -257,6 +258,7 @@ def test_method_preview_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -322,6 +324,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -531,6 +534,7 @@ async def test_method_preview_with_all_params(self, async_client: AsyncRunloop)
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/test_devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -939,6 +940,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/test_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -239,6 +240,7 @@ def test_method_update_with_all_params(self, client: Runloop) -> None:
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -499,6 +501,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down Expand Up @@ -661,6 +664,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncRunloop) -
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"architecture": "x86_64",
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from runloop_api_client import Runloop, AsyncRunloop

if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest
from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage]

pytest.register_assert_rewrite("tests.utils")

Expand Down
5 changes: 4 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,15 @@ class Model(BaseModel):
resource_id: Optional[str] = None

m = Model.construct()
assert m.resource_id is None
assert "resource_id" not in m.model_fields_set

m = Model.construct(resource_id=None)
assert m.resource_id is None
assert "resource_id" in m.model_fields_set

m = Model.construct(resource_id="foo")
assert m.resource_id == "foo"
assert "resource_id" in m.model_fields_set


Expand Down Expand Up @@ -832,7 +835,7 @@ class B(BaseModel):

@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1")
def test_type_alias_type() -> None:
Alias = TypeAliasType("Alias", str)
Alias = TypeAliasType("Alias", str) # pyright: ignore

class Model(BaseModel):
alias: Alias
Expand Down
Loading