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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/kernel-python'
id: github-oidc
uses: actions/github-script@v6
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

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.28.0"
".": "0.29.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: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d430a8e3407ceb608d912cabadbcb016b4fcf057ca56b3bbd179ea3b3121b484.yml
openapi_spec_hash: 8adbf013baf77abacaf04ed067749397
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-46c8320dcd9f8fc596f469ef0dd1aafaca591ab36cf2a6f8a7297dc9136bdc71.yml
openapi_spec_hash: 1be1e6589cd94c581b241720e01a65bc
config_hash: b470456b217bb9502f5212311d395a6f
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.29.0 (2026-01-30)

Full Changelog: [v0.28.0...v0.29.0](https://github.com/kernel/kernel-python-sdk/compare/v0.28.0...v0.29.0)

### Features

* add support for 1280x800@60 viewport ([1cb6575](https://github.com/kernel/kernel-python-sdk/commit/1cb65752f6aa45fcb2ca1dd55f0eebf9457abfa9))
* **client:** add custom JSON encoder for extended type support ([33604fe](https://github.com/kernel/kernel-python-sdk/commit/33604feb1a07bbca94477c28143052d5c6eff70d))


### Chores

* **ci:** upgrade `actions/github-script` ([4828aba](https://github.com/kernel/kernel-python-sdk/commit/4828aba4349e61686285b57358892825e75286be))

## 0.28.0 (2026-01-22)

Full Changelog: [v0.27.0...v0.28.0](https://github.com/kernel/kernel-python-sdk/compare/v0.27.0...v0.28.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 = "kernel"
version = "0.28.0"
version = "0.29.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
7 changes: 5 additions & 2 deletions src/kernel/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
APIConnectionError,
APIResponseValidationError,
)
from ._utils._json import openapi_dumps

log: logging.Logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -554,8 +555,10 @@ def _build_request(
kwargs["content"] = options.content
elif isinstance(json_data, bytes):
kwargs["content"] = json_data
else:
kwargs["json"] = json_data if is_given(json_data) else None
elif not files:
# Don't set content when JSON is sent as multipart/form-data,
# since httpx's content param overrides other body arguments
kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)
Expand Down
6 changes: 3 additions & 3 deletions src/kernel/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def model_dump(
exclude_defaults: bool = False,
warnings: bool = True,
mode: Literal["json", "python"] = "python",
by_alias: bool | None = None,
) -> dict[str, Any]:
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
return model.model_dump(
Expand All @@ -148,13 +149,12 @@ def model_dump(
exclude_defaults=exclude_defaults,
# warnings are not supported in Pydantic v1
warnings=True if PYDANTIC_V1 else warnings,
by_alias=by_alias,
)
return cast(
"dict[str, Any]",
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
),
)

Expand Down
35 changes: 35 additions & 0 deletions src/kernel/_utils/_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import json
from typing import Any
from datetime import datetime
from typing_extensions import override

import pydantic

from .._compat import model_dump


def openapi_dumps(obj: Any) -> bytes:
"""
Serialize an object to UTF-8 encoded JSON bytes.
Extends the standard json.dumps with support for additional types
commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
"""
return json.dumps(
obj,
cls=_CustomEncoder,
# Uses the same defaults as httpx's JSON serialization
ensure_ascii=False,
separators=(",", ":"),
allow_nan=False,
).encode()


class _CustomEncoder(json.JSONEncoder):
@override
def default(self, o: Any) -> Any:
if isinstance(o, datetime):
return o.isoformat()
if isinstance(o, pydantic.BaseModel):
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
return super().default(o)
2 changes: 1 addition & 1 deletion src/kernel/_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__ = "kernel"
__version__ = "0.28.0" # x-release-please-version
__version__ = "0.29.0" # x-release-please-version
16 changes: 8 additions & 8 deletions src/kernel/resources/browser_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def create(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down Expand Up @@ -243,8 +243,8 @@ def update(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down Expand Up @@ -549,8 +549,8 @@ async def create(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down Expand Up @@ -681,8 +681,8 @@ async def update(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down
8 changes: 4 additions & 4 deletions src/kernel/resources/browsers/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def create(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down Expand Up @@ -599,8 +599,8 @@ async def create(
image defaults apply (1920x1080@25). Only specific viewport configurations are
supported. The server will reject unsupported combinations. Supported
resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
automatically determined from the width and height if they match a supported
1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser

Expand Down
8 changes: 4 additions & 4 deletions src/kernel/types/browser_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class BrowserCreateParams(TypedDict, total=False):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class BrowserCreateResponse(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class BrowserListResponse(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class BrowserPoolConfig(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""


Expand Down
8 changes: 4 additions & 4 deletions src/kernel/types/browser_pool_acquire_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class BrowserPoolAcquireResponse(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_pool_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class BrowserPoolCreateParams(TypedDict, total=False):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_pool_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class BrowserPoolUpdateParams(TypedDict, total=False):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_retrieve_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class BrowserRetrieveResponse(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
8 changes: 4 additions & 4 deletions src/kernel/types/browser_update_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class BrowserUpdateResponse(BaseModel):
If omitted, image defaults apply (1920x1080@25). Only specific viewport
configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
be automatically determined from the width and height if they match a supported
configuration exactly. Note: Higher resolutions may affect the responsiveness of
live view browser
1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not
provided, it will be automatically determined from the width and height if they
match a supported configuration exactly. Note: Higher resolutions may affect the
responsiveness of live view browser
"""
2 changes: 1 addition & 1 deletion src/kernel/types/shared/browser_viewport.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BrowserViewport(BaseModel):

If omitted, image defaults apply (1920x1080@25).
Only specific viewport configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1024x768@60, 1200x800@60
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60
If refresh_rate is not provided, it will be automatically determined from the width and height if they match a supported configuration exactly.
Note: Higher resolutions may affect the responsiveness of live view browser
"""
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/types/shared_params/browser_viewport.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BrowserViewport(TypedDict, total=False):

If omitted, image defaults apply (1920x1080@25).
Only specific viewport configurations are supported. The server will reject unsupported combinations.
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1024x768@60, 1200x800@60
Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60
If refresh_rate is not provided, it will be automatically determined from the width and height if they match a supported configuration exactly.
Note: Higher resolutions may affect the responsiveness of live view browser
"""
Expand Down
Loading