Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
83e4f2c
chore(tests): run tests in parallel
stainless-app[bot] Jun 13, 2025
0079349
fix(client): correctly parse binary response | stream
stainless-app[bot] Jun 13, 2025
7bd810a
codegen metadata
stainless-app[bot] Jun 14, 2025
2e69f99
codegen metadata
stainless-app[bot] Jun 14, 2025
496e5cd
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
452e83c
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
d51332b
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
7699111
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
eed8e67
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
c1cdbcc
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
8073db6
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
fe8d70b
feat(api): update via SDK Studio
stainless-app[bot] Jun 14, 2025
235bf24
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 17, 2025
bcfcef2
chore(internal): update conftest.py
stainless-app[bot] Jun 17, 2025
fb3fba1
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
ff07935
feat(api): update via SDK Studio
stainless-app[bot] Jun 17, 2025
d26c519
feat(api): update via SDK Studio
stainless-app[bot] Jun 17, 2025
dff3e39
feat(api): update via SDK Studio
stainless-app[bot] Jun 17, 2025
0c8937a
feat(api): update via SDK Studio
stainless-app[bot] Jun 17, 2025
a811017
feat(api): update via SDK Studio
stainless-app[bot] Jun 17, 2025
099868c
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
53d6547
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 18, 2025
834f1e9
release: 0.6.0
stainless-app[bot] Jun 18, 2025
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
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.5.0"
".": "0.6.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-4502c65bef0843a6ae96d23bba075433af6bab49b55b544b1522f63e7881c00c.yml
openapi_spec_hash: 3e67b77bbc8cd6155b8f66f3271f2643
config_hash: c6bab7ac8da570a5abbcfb19db119b6b
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5d4e11bc46eeecee7363d56a9dfe946acee997d5b352c2b0a50c20e742c54d2d.yml
openapi_spec_hash: 333e53ad9c706296b9afdb8ff73bec8f
config_hash: 0fdf285ddd8dee229fd84ea57df9080f
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 0.6.0 (2025-06-18)

Full Changelog: [v0.5.0...v0.6.0](https://github.com/onkernel/kernel-python-sdk/compare/v0.5.0...v0.6.0)

### Features

* **api:** update via SDK Studio ([a811017](https://github.com/onkernel/kernel-python-sdk/commit/a81101709db8cb64b4cb6af6b749b55f86c24be6))
* **api:** update via SDK Studio ([0c8937a](https://github.com/onkernel/kernel-python-sdk/commit/0c8937a4d8891357223c41fadcb05a6dd1f359b1))
* **api:** update via SDK Studio ([dff3e39](https://github.com/onkernel/kernel-python-sdk/commit/dff3e3965fc710beadac2410a8a065d81b889d43))
* **api:** update via SDK Studio ([d26c519](https://github.com/onkernel/kernel-python-sdk/commit/d26c519a798d8bf66baaef49af818b4108c3d92a))
* **api:** update via SDK Studio ([ff07935](https://github.com/onkernel/kernel-python-sdk/commit/ff0793585ded6d9ea6c50947b9915f560221ed0f))
* **api:** update via SDK Studio ([fe8d70b](https://github.com/onkernel/kernel-python-sdk/commit/fe8d70b1f0a0725c37c794aeb5a7a466bc13cdf3))
* **api:** update via SDK Studio ([8073db6](https://github.com/onkernel/kernel-python-sdk/commit/8073db60205835e3abb6c494e24bb034283c55f2))
* **api:** update via SDK Studio ([c1cdbcc](https://github.com/onkernel/kernel-python-sdk/commit/c1cdbcc6e555ab5fc7ecc229095ff7d0bf272e1a))
* **api:** update via SDK Studio ([eed8e67](https://github.com/onkernel/kernel-python-sdk/commit/eed8e6769fd4982cadb277aa4c271c211992077a))
* **api:** update via SDK Studio ([7699111](https://github.com/onkernel/kernel-python-sdk/commit/76991114e757c0c054e89d614619e38b2ec7d918))
* **api:** update via SDK Studio ([d51332b](https://github.com/onkernel/kernel-python-sdk/commit/d51332b18af547affb215d9a7596bbbdb7ccff24))
* **api:** update via SDK Studio ([452e83c](https://github.com/onkernel/kernel-python-sdk/commit/452e83c41d808b97e1ff54cdfa79d74abccfc9b5))
* **api:** update via SDK Studio ([496e5cd](https://github.com/onkernel/kernel-python-sdk/commit/496e5cd31745446c16234120f9299be4a9830bb5))


### Bug Fixes

* **client:** correctly parse binary response | stream ([0079349](https://github.com/onkernel/kernel-python-sdk/commit/007934910a1ec8e17a6be821feacef9b42a2c142))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([53d6547](https://github.com/onkernel/kernel-python-sdk/commit/53d65471447af6f764aa48bd708c540215c8fd4a))


### Chores

* **ci:** enable for pull requests ([fb3fba1](https://github.com/onkernel/kernel-python-sdk/commit/fb3fba16b9149449f8327b909210d42ee7744ba4))
* **internal:** update conftest.py ([bcfcef2](https://github.com/onkernel/kernel-python-sdk/commit/bcfcef2eb9cd584ad6ec508956d59b34211d2e14))
* **readme:** update badges ([099868c](https://github.com/onkernel/kernel-python-sdk/commit/099868c0c2fbb92a4b9e97cda89bf4e71781d76f))
* **tests:** add tests for httpx client instantiation & proxies ([235bf24](https://github.com/onkernel/kernel-python-sdk/commit/235bf248a71505c9d5d536f1b6a7120e43b9cedc))
* **tests:** run tests in parallel ([83e4f2c](https://github.com/onkernel/kernel-python-sdk/commit/83e4f2c26f02a7df56917e993af1e1d85ba241e6))

## 0.5.0 (2025-06-03)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/onkernel/kernel-python-sdk/compare/v0.4.0...v0.5.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kernel Python API library

[![PyPI version](https://img.shields.io/pypi/v/kernel.svg)](https://pypi.org/project/kernel/)
[![PyPI version](<https://img.shields.io/pypi/v/kernel.svg?label=pypi%20(stable)>)](https://pypi.org/project/kernel/)

The Kernel Python library provides convenient access to the Kernel REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down
38 changes: 33 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Shared Types

```python
from kernel.types import ErrorDetail, ErrorEvent, ErrorModel, LogEvent
```

# Deployments

Types:

```python
from kernel.types import (
DeploymentStateEvent,
DeploymentCreateResponse,
DeploymentRetrieveResponse,
DeploymentFollowResponse,
)
```

Methods:

- <code title="post /deployments">client.deployments.<a href="./src/kernel/resources/deployments.py">create</a>(\*\*<a href="src/kernel/types/deployment_create_params.py">params</a>) -> <a href="./src/kernel/types/deployment_create_response.py">DeploymentCreateResponse</a></code>
- <code title="get /deployments/{id}">client.deployments.<a href="./src/kernel/resources/deployments.py">retrieve</a>(id) -> <a href="./src/kernel/types/deployment_retrieve_response.py">DeploymentRetrieveResponse</a></code>
- <code title="get /deployments/{id}/events">client.deployments.<a href="./src/kernel/resources/deployments.py">follow</a>(id) -> <a href="./src/kernel/types/deployment_follow_response.py">DeploymentFollowResponse</a></code>

# Apps

Types:
Expand All @@ -23,23 +48,26 @@ Methods:
- <code title="post /deploy">client.apps.deployments.<a href="./src/kernel/resources/apps/deployments.py">create</a>(\*\*<a href="src/kernel/types/apps/deployment_create_params.py">params</a>) -> <a href="./src/kernel/types/apps/deployment_create_response.py">DeploymentCreateResponse</a></code>
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/kernel/resources/apps/deployments.py">follow</a>(id) -> <a href="./src/kernel/types/apps/deployment_follow_response.py">DeploymentFollowResponse</a></code>

## Invocations
# Invocations

Types:

```python
from kernel.types.apps import (
from kernel.types import (
InvocationStateEvent,
InvocationCreateResponse,
InvocationRetrieveResponse,
InvocationUpdateResponse,
InvocationFollowResponse,
)
```

Methods:

- <code title="post /invocations">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">create</a>(\*\*<a href="src/kernel/types/apps/invocation_create_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_create_response.py">InvocationCreateResponse</a></code>
- <code title="get /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">retrieve</a>(id) -> <a href="./src/kernel/types/apps/invocation_retrieve_response.py">InvocationRetrieveResponse</a></code>
- <code title="patch /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">update</a>(id, \*\*<a href="src/kernel/types/apps/invocation_update_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_update_response.py">InvocationUpdateResponse</a></code>
- <code title="post /invocations">client.invocations.<a href="./src/kernel/resources/invocations.py">create</a>(\*\*<a href="src/kernel/types/invocation_create_params.py">params</a>) -> <a href="./src/kernel/types/invocation_create_response.py">InvocationCreateResponse</a></code>
- <code title="get /invocations/{id}">client.invocations.<a href="./src/kernel/resources/invocations.py">retrieve</a>(id) -> <a href="./src/kernel/types/invocation_retrieve_response.py">InvocationRetrieveResponse</a></code>
- <code title="patch /invocations/{id}">client.invocations.<a href="./src/kernel/resources/invocations.py">update</a>(id, \*\*<a href="src/kernel/types/invocation_update_params.py">params</a>) -> <a href="./src/kernel/types/invocation_update_response.py">InvocationUpdateResponse</a></code>
- <code title="get /invocations/{id}/events">client.invocations.<a href="./src/kernel/resources/invocations.py">follow</a>(id) -> <a href="./src/kernel/types/invocation_follow_response.py">InvocationFollowResponse</a></code>

# Browsers

Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kernel"
version = "0.5.0"
version = "0.6.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -54,6 +54,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

[tool.rye.scripts]
Expand Down Expand Up @@ -125,7 +126,7 @@ replacement = '[\1](https://github.com/onkernel/kernel-python-sdk/tree/main/\g<2

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
addopts = "--tb=short -n auto"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
4 changes: 4 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ distro==1.8.0
exceptiongroup==1.2.2
# via anyio
# via pytest
execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
h11==0.14.0
Expand Down Expand Up @@ -72,7 +74,9 @@ pygments==2.18.0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
# via pytest-xdist
pytest-asyncio==0.24.0
pytest-xdist==3.7.0
python-dateutil==2.8.2
# via time-machine
pytz==2023.3.post1
Expand Down
18 changes: 16 additions & 2 deletions src/kernel/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,14 @@ def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, APIResponse):
raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")

Expand Down Expand Up @@ -1574,7 +1581,14 @@ async def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, AsyncAPIResponse):
raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")

Expand Down
18 changes: 17 additions & 1 deletion src/kernel/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
from ._utils import is_given, get_async_library
from ._version import __version__
from .resources import browsers
from .resources import browsers, deployments, invocations
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import KernelError, APIStatusError
from ._base_client import (
Expand Down Expand Up @@ -50,7 +50,9 @@


class Kernel(SyncAPIClient):
deployments: deployments.DeploymentsResource
apps: apps.AppsResource
invocations: invocations.InvocationsResource
browsers: browsers.BrowsersResource
with_raw_response: KernelWithRawResponse
with_streaming_response: KernelWithStreamedResponse
Expand Down Expand Up @@ -133,7 +135,9 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.deployments = deployments.DeploymentsResource(self)
self.apps = apps.AppsResource(self)
self.invocations = invocations.InvocationsResource(self)
self.browsers = browsers.BrowsersResource(self)
self.with_raw_response = KernelWithRawResponse(self)
self.with_streaming_response = KernelWithStreamedResponse(self)
Expand Down Expand Up @@ -246,7 +250,9 @@ def _make_status_error(


class AsyncKernel(AsyncAPIClient):
deployments: deployments.AsyncDeploymentsResource
apps: apps.AsyncAppsResource
invocations: invocations.AsyncInvocationsResource
browsers: browsers.AsyncBrowsersResource
with_raw_response: AsyncKernelWithRawResponse
with_streaming_response: AsyncKernelWithStreamedResponse
Expand Down Expand Up @@ -329,7 +335,9 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.deployments = deployments.AsyncDeploymentsResource(self)
self.apps = apps.AsyncAppsResource(self)
self.invocations = invocations.AsyncInvocationsResource(self)
self.browsers = browsers.AsyncBrowsersResource(self)
self.with_raw_response = AsyncKernelWithRawResponse(self)
self.with_streaming_response = AsyncKernelWithStreamedResponse(self)
Expand Down Expand Up @@ -443,25 +451,33 @@ def _make_status_error(

class KernelWithRawResponse:
def __init__(self, client: Kernel) -> None:
self.deployments = deployments.DeploymentsResourceWithRawResponse(client.deployments)
self.apps = apps.AppsResourceWithRawResponse(client.apps)
self.invocations = invocations.InvocationsResourceWithRawResponse(client.invocations)
self.browsers = browsers.BrowsersResourceWithRawResponse(client.browsers)


class AsyncKernelWithRawResponse:
def __init__(self, client: AsyncKernel) -> None:
self.deployments = deployments.AsyncDeploymentsResourceWithRawResponse(client.deployments)
self.apps = apps.AsyncAppsResourceWithRawResponse(client.apps)
self.invocations = invocations.AsyncInvocationsResourceWithRawResponse(client.invocations)
self.browsers = browsers.AsyncBrowsersResourceWithRawResponse(client.browsers)


class KernelWithStreamedResponse:
def __init__(self, client: Kernel) -> None:
self.deployments = deployments.DeploymentsResourceWithStreamingResponse(client.deployments)
self.apps = apps.AppsResourceWithStreamingResponse(client.apps)
self.invocations = invocations.InvocationsResourceWithStreamingResponse(client.invocations)
self.browsers = browsers.BrowsersResourceWithStreamingResponse(client.browsers)


class AsyncKernelWithStreamedResponse:
def __init__(self, client: AsyncKernel) -> None:
self.deployments = deployments.AsyncDeploymentsResourceWithStreamingResponse(client.deployments)
self.apps = apps.AsyncAppsResourceWithStreamingResponse(client.apps)
self.invocations = invocations.AsyncInvocationsResourceWithStreamingResponse(client.invocations)
self.browsers = browsers.AsyncBrowsersResourceWithStreamingResponse(client.browsers)


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.5.0" # x-release-please-version
__version__ = "0.6.0" # x-release-please-version
28 changes: 28 additions & 0 deletions src/kernel/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,42 @@
BrowsersResourceWithStreamingResponse,
AsyncBrowsersResourceWithStreamingResponse,
)
from .deployments import (
DeploymentsResource,
AsyncDeploymentsResource,
DeploymentsResourceWithRawResponse,
AsyncDeploymentsResourceWithRawResponse,
DeploymentsResourceWithStreamingResponse,
AsyncDeploymentsResourceWithStreamingResponse,
)
from .invocations import (
InvocationsResource,
AsyncInvocationsResource,
InvocationsResourceWithRawResponse,
AsyncInvocationsResourceWithRawResponse,
InvocationsResourceWithStreamingResponse,
AsyncInvocationsResourceWithStreamingResponse,
)

__all__ = [
"DeploymentsResource",
"AsyncDeploymentsResource",
"DeploymentsResourceWithRawResponse",
"AsyncDeploymentsResourceWithRawResponse",
"DeploymentsResourceWithStreamingResponse",
"AsyncDeploymentsResourceWithStreamingResponse",
"AppsResource",
"AsyncAppsResource",
"AppsResourceWithRawResponse",
"AsyncAppsResourceWithRawResponse",
"AppsResourceWithStreamingResponse",
"AsyncAppsResourceWithStreamingResponse",
"InvocationsResource",
"AsyncInvocationsResource",
"InvocationsResourceWithRawResponse",
"AsyncInvocationsResourceWithRawResponse",
"InvocationsResourceWithStreamingResponse",
"AsyncInvocationsResourceWithStreamingResponse",
"BrowsersResource",
"AsyncBrowsersResource",
"BrowsersResourceWithRawResponse",
Expand Down
14 changes: 0 additions & 14 deletions src/kernel/resources/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
DeploymentsResourceWithStreamingResponse,
AsyncDeploymentsResourceWithStreamingResponse,
)
from .invocations import (
InvocationsResource,
AsyncInvocationsResource,
InvocationsResourceWithRawResponse,
AsyncInvocationsResourceWithRawResponse,
InvocationsResourceWithStreamingResponse,
AsyncInvocationsResourceWithStreamingResponse,
)

__all__ = [
"DeploymentsResource",
Expand All @@ -32,12 +24,6 @@
"AsyncDeploymentsResourceWithRawResponse",
"DeploymentsResourceWithStreamingResponse",
"AsyncDeploymentsResourceWithStreamingResponse",
"InvocationsResource",
"AsyncInvocationsResource",
"InvocationsResourceWithRawResponse",
"AsyncInvocationsResourceWithRawResponse",
"InvocationsResourceWithStreamingResponse",
"AsyncInvocationsResourceWithStreamingResponse",
"AppsResource",
"AsyncAppsResource",
"AppsResourceWithRawResponse",
Expand Down
Loading