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.37.0"
".": "0.38.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: 101
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-fc4a441d80d9a26574ef8af390a0c76265f5d4190daf90a04b6b353b128bbd97.yml
openapi_spec_hash: 192987649d3797c3a80e6ef201667b64
config_hash: 8af430e19f4af86c05f2987241cae72f
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-9462b3d8f055f8bda06da65583f5aa09a17d35254c5983796d8e84ebb3c62c47.yml
openapi_spec_hash: 1914dd35b8e0e5a21ccec91eac2a616d
config_hash: c6b88eea9a15840f26130eb8ed3b42a0
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.38.0 (2026-02-25)

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

### Features

* Neil/kernel 1029 past session search ([657da45](https://github.com/kernel/kernel-python-sdk/commit/657da45a969b52a8497efbcd597fe8b705dab370))


### Chores

* **internal:** add request options to SSE classes ([6287415](https://github.com/kernel/kernel-python-sdk/commit/628741509bbaf2b693afc71cc28ad82a8dc7b231))
* **internal:** make `test_proxy_environment_variables` more resilient ([3345fc6](https://github.com/kernel/kernel-python-sdk/commit/3345fc63467e18401a501a6df0b71dae46f70113))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([6a629ee](https://github.com/kernel/kernel-python-sdk/commit/6a629ee6e943bac9b87154ac440c760765185206))

## 0.37.0 (2026-02-23)

Full Changelog: [v0.36.1...v0.37.0](https://github.com/kernel/kernel-python-sdk/compare/v0.36.1...v0.37.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.37.0"
version = "0.38.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
3 changes: 3 additions & 0 deletions src/kernel/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=extract_stream_chunk_type(self._stream_cls),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=cast_to,
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand Down
11 changes: 8 additions & 3 deletions src/kernel/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import inspect
from types import TracebackType
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable

import httpx
Expand All @@ -13,6 +13,7 @@

if TYPE_CHECKING:
from ._client import Kernel, AsyncKernel
from ._models import FinalRequestOptions


_T = TypeVar("_T")
Expand All @@ -22,7 +23,7 @@ class Stream(Generic[_T]):
"""Provides the core interface to iterate over a synchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEBytesDecoder

def __init__(
Expand All @@ -31,10 +32,12 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: Kernel,
options: Optional[FinalRequestOptions] = None,
) -> None:
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()

Expand Down Expand Up @@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]):
"""Provides the core interface to iterate over an asynchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEDecoder | SSEBytesDecoder

def __init__(
Expand All @@ -94,10 +97,12 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: AsyncKernel,
options: Optional[FinalRequestOptions] = None,
) -> None:
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()

Expand Down
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.37.0" # x-release-please-version
__version__ = "0.38.0" # x-release-please-version
8 changes: 8 additions & 0 deletions src/kernel/resources/browsers/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def list(
include_deleted: bool | Omit = omit,
limit: int | Omit = omit,
offset: int | Omit = omit,
query: str | Omit = omit,
status: Literal["active", "deleted", "all"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -350,6 +351,8 @@ def list(

offset: Number of results to skip. Defaults to 0.

query: Search browsers by session ID, profile ID, or proxy ID.

status: Filter sessions by status. "active" returns only active sessions (default),
"deleted" returns only soft-deleted sessions, "all" returns both.

Expand All @@ -374,6 +377,7 @@ def list(
"include_deleted": include_deleted,
"limit": limit,
"offset": offset,
"query": query,
"status": status,
},
browser_list_params.BrowserListParams,
Expand Down Expand Up @@ -745,6 +749,7 @@ def list(
include_deleted: bool | Omit = omit,
limit: int | Omit = omit,
offset: int | Omit = omit,
query: str | Omit = omit,
status: Literal["active", "deleted", "all"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -766,6 +771,8 @@ def list(

offset: Number of results to skip. Defaults to 0.

query: Search browsers by session ID, profile ID, or proxy ID.

status: Filter sessions by status. "active" returns only active sessions (default),
"deleted" returns only soft-deleted sessions, "all" returns both.

Expand All @@ -790,6 +797,7 @@ def list(
"include_deleted": include_deleted,
"limit": limit,
"offset": offset,
"query": query,
"status": status,
},
browser_list_params.BrowserListParams,
Expand Down
3 changes: 3 additions & 0 deletions src/kernel/types/browser_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class BrowserListParams(TypedDict, total=False):
offset: int
"""Number of results to skip. Defaults to 0."""

query: str
"""Search browsers by session ID, profile ID, or proxy ID."""

status: Literal["active", "deleted", "all"]
"""Filter sessions by status.

Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/test_browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def test_method_list_with_all_params(self, client: Kernel) -> None:
include_deleted=True,
limit=1,
offset=0,
query="query",
status="active",
)
assert_matches_type(SyncOffsetPagination[BrowserListResponse], browser, path=["response"])
Expand Down Expand Up @@ -571,6 +572,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncKernel) -> N
include_deleted=True,
limit=1,
offset=0,
query="query",
status="active",
)
assert_matches_type(AsyncOffsetPagination[BrowserListResponse], browser, path=["response"])
Expand Down
16 changes: 16 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
# Test that the proxy environment variables are set correctly
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
# Delete in case our environment has any proxy env vars set
monkeypatch.delenv("HTTP_PROXY", raising=False)
monkeypatch.delenv("ALL_PROXY", raising=False)
monkeypatch.delenv("NO_PROXY", raising=False)
monkeypatch.delenv("http_proxy", raising=False)
monkeypatch.delenv("https_proxy", raising=False)
monkeypatch.delenv("all_proxy", raising=False)
monkeypatch.delenv("no_proxy", raising=False)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy env var set then immediately deleted on Windows

Low Severity

monkeypatch.setenv("HTTPS_PROXY", ...) is called before monkeypatch.delenv("https_proxy", ...). On Windows, os.environ is case-insensitive (all keys uppercased), so the delenv("https_proxy") call deletes the HTTPS_PROXY that was just set. This causes the test to fail on Windows. Moving setenv after all delenv calls would fix the ordering issue.

Additional Locations (1)

Fix in Cursor Fix in Web


client = DefaultHttpxClient()

Expand Down Expand Up @@ -1873,6 +1881,14 @@ async def test_get_platform(self) -> None:
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
# Test that the proxy environment variables are set correctly
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
# Delete in case our environment has any proxy env vars set
monkeypatch.delenv("HTTP_PROXY", raising=False)
monkeypatch.delenv("ALL_PROXY", raising=False)
monkeypatch.delenv("NO_PROXY", raising=False)
monkeypatch.delenv("http_proxy", raising=False)
monkeypatch.delenv("https_proxy", raising=False)
monkeypatch.delenv("all_proxy", raising=False)
monkeypatch.delenv("no_proxy", raising=False)

client = DefaultAsyncHttpxClient()

Expand Down