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.1.0-alpha.7"
".": "0.1.0-alpha.8"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d168b58fcf39dbd0458d132091793d3e2d0930070b7dda2d5f7f1baff20dd31b.yml
openapi_spec_hash: b7e0fd7ee1656d7dbad57209d1584d92
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml
openapi_spec_hash: be02256478be81fa3f649076879850bc
config_hash: eab40627b734534462ae3b8ccd8b263b
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.8 (2025-05-12)

Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/onkernel/kernel-python-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)

### Features

* **api:** update via SDK Studio ([68c2cc8](https://github.com/onkernel/kernel-python-sdk/commit/68c2cc821cf9c31f8e5e054ba69780cbba2449db))

## 0.1.0-alpha.7 (2025-05-11)

Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/onkernel/kernel-python-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
Expand Down
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ client = Kernel(
)

response = client.apps.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
print(response.id)
print(response.apps)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -64,11 +63,10 @@ client = AsyncKernel(

async def main() -> None:
response = await client.apps.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
print(response.id)
print(response.apps)


asyncio.run(main())
Expand Down Expand Up @@ -96,9 +94,7 @@ from kernel import Kernel
client = Kernel()

client.apps.deploy(
app_name="my-awesome-app",
file=Path("/path/to/file"),
version="1.0.0",
)
```

Expand All @@ -121,7 +117,6 @@ client = Kernel()

try:
client.apps.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand Down Expand Up @@ -168,7 +163,6 @@ client = Kernel(

# Or, configure per-request:
client.with_options(max_retries=5).apps.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand All @@ -195,7 +189,6 @@ client = Kernel(

# Override per-request:
client.with_options(timeout=5.0).apps.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand Down Expand Up @@ -240,14 +233,13 @@ from kernel import Kernel

client = Kernel()
response = client.apps.with_raw_response.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
print(response.headers.get('X-My-Header'))

app = response.parse() # get the object that `apps.deploy()` would have returned
print(app.id)
print(app.apps)
```

These methods return an [`APIResponse`](https://github.com/onkernel/kernel-python-sdk/tree/main/src/kernel/_response.py) object.
Expand All @@ -262,7 +254,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi

```python
with client.apps.with_streaming_response.deploy(
app_name="REPLACE_ME",
file=b"REPLACE_ME",
version="REPLACE_ME",
) as response:
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ from kernel.types import BrowserCreateSessionResponse

Methods:

- <code title="post /browser">client.browser.<a href="./src/kernel/resources/browser.py">create_session</a>() -> <a href="./src/kernel/types/browser_create_session_response.py">BrowserCreateSessionResponse</a></code>
- <code title="post /browser">client.browser.<a href="./src/kernel/resources/browser.py">create_session</a>(\*\*<a href="src/kernel/types/browser_create_session_params.py">params</a>) -> <a href="./src/kernel/types/browser_create_session_response.py">BrowserCreateSessionResponse</a></code>
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.1.0-alpha.7"
version = "0.1.0-alpha.8"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
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.1.0-alpha.7" # x-release-please-version
__version__ = "0.1.0-alpha.8" # x-release-please-version
45 changes: 27 additions & 18 deletions src/kernel/resources/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from typing import Mapping, cast
from typing_extensions import Literal

import httpx

Expand Down Expand Up @@ -48,10 +49,11 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse:
def deploy(
self,
*,
app_name: str,
file: FileTypes,
version: str,
region: str | NotGiven = NOT_GIVEN,
entrypoint_rel_path: str | NotGiven = NOT_GIVEN,
force: Literal["true", "false"] | NotGiven = NOT_GIVEN,
region: Literal["aws.us-east-1a"] | NotGiven = NOT_GIVEN,
version: str | NotGiven = NOT_GIVEN,
# 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.
extra_headers: Headers | None = None,
Expand All @@ -63,13 +65,15 @@ def deploy(
Deploy a new application

Args:
app_name: Name of the application
file: ZIP file containing the application source directory

file: ZIP file containing the application
entrypoint_rel_path: Relative path to the entrypoint of the application

version: Version of the application
force: Allow overwriting an existing app version

region: AWS region for deployment (e.g. "aws.us-east-1a")
region: Region for deployment. Currently we only support "aws.us-east-1a"

version: Version of the application. Can be any string.

extra_headers: Send extra headers

Expand All @@ -81,10 +85,11 @@ def deploy(
"""
body = deepcopy_minimal(
{
"app_name": app_name,
"file": file,
"version": version,
"entrypoint_rel_path": entrypoint_rel_path,
"force": force,
"region": region,
"version": version,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
Expand Down Expand Up @@ -210,10 +215,11 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse:
async def deploy(
self,
*,
app_name: str,
file: FileTypes,
version: str,
region: str | NotGiven = NOT_GIVEN,
entrypoint_rel_path: str | NotGiven = NOT_GIVEN,
force: Literal["true", "false"] | NotGiven = NOT_GIVEN,
region: Literal["aws.us-east-1a"] | NotGiven = NOT_GIVEN,
version: str | NotGiven = NOT_GIVEN,
# 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.
extra_headers: Headers | None = None,
Expand All @@ -225,13 +231,15 @@ async def deploy(
Deploy a new application

Args:
app_name: Name of the application
file: ZIP file containing the application source directory

file: ZIP file containing the application
entrypoint_rel_path: Relative path to the entrypoint of the application

version: Version of the application
force: Allow overwriting an existing app version

region: AWS region for deployment (e.g. "aws.us-east-1a")
region: Region for deployment. Currently we only support "aws.us-east-1a"

version: Version of the application. Can be any string.

extra_headers: Send extra headers

Expand All @@ -243,10 +251,11 @@ async def deploy(
"""
body = deepcopy_minimal(
{
"app_name": app_name,
"file": file,
"version": version,
"entrypoint_rel_path": entrypoint_rel_path,
"force": force,
"region": region,
"version": version,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
Expand Down
40 changes: 38 additions & 2 deletions src/kernel/resources/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import httpx

from ..types import browser_create_session_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand Down Expand Up @@ -42,16 +44,33 @@ def with_streaming_response(self) -> BrowserResourceWithStreamingResponse:
def create_session(
self,
*,
invocation_id: str,
# 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserCreateSessionResponse:
"""Create Browser Session"""
"""
Create Browser Session

Args:
invocation_id: Kernel App invocation ID

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/browser",
body=maybe_transform(
{"invocation_id": invocation_id}, browser_create_session_params.BrowserCreateSessionParams
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -82,16 +101,33 @@ def with_streaming_response(self) -> AsyncBrowserResourceWithStreamingResponse:
async def create_session(
self,
*,
invocation_id: str,
# 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserCreateSessionResponse:
"""Create Browser Session"""
"""
Create Browser Session

Args:
invocation_id: Kernel App invocation ID

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/browser",
body=await async_maybe_transform(
{"invocation_id": invocation_id}, browser_create_session_params.BrowserCreateSessionParams
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
1 change: 1 addition & 0 deletions src/kernel/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
from .app_invoke_params import AppInvokeParams as AppInvokeParams
from .app_deploy_response import AppDeployResponse as AppDeployResponse
from .app_invoke_response import AppInvokeResponse as AppInvokeResponse
from .browser_create_session_params import BrowserCreateSessionParams as BrowserCreateSessionParams
from .browser_create_session_response import BrowserCreateSessionResponse as BrowserCreateSessionResponse
from .app_retrieve_invocation_response import AppRetrieveInvocationResponse as AppRetrieveInvocationResponse
21 changes: 12 additions & 9 deletions src/kernel/types/app_deploy_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing_extensions import Required, Annotated, TypedDict
from typing_extensions import Literal, Required, Annotated, TypedDict

from .._types import FileTypes
from .._utils import PropertyInfo
Expand All @@ -11,14 +11,17 @@


class AppDeployParams(TypedDict, total=False):
app_name: Required[Annotated[str, PropertyInfo(alias="appName")]]
"""Name of the application"""

file: Required[FileTypes]
"""ZIP file containing the application"""
"""ZIP file containing the application source directory"""

entrypoint_rel_path: Annotated[str, PropertyInfo(alias="entrypointRelPath")]
"""Relative path to the entrypoint of the application"""

force: Literal["true", "false"]
"""Allow overwriting an existing app version"""

version: Required[str]
"""Version of the application"""
region: Literal["aws.us-east-1a"]
"""Region for deployment. Currently we only support "aws.us-east-1a" """

region: str
"""AWS region for deployment (e.g. "aws.us-east-1a")"""
version: str
"""Version of the application. Can be any string."""
22 changes: 19 additions & 3 deletions src/kernel/types/app_deploy_response.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel

__all__ = ["AppDeployResponse"]
__all__ = ["AppDeployResponse", "App", "AppAction"]


class AppDeployResponse(BaseModel):
class AppAction(BaseModel):
name: str
"""Name of the action"""


class App(BaseModel):
id: str
"""ID of the deployed app version"""
"""ID for the app version deployed"""

actions: List[AppAction]

name: str
"""Name of the app"""


class AppDeployResponse(BaseModel):
apps: List[App]

message: str
"""Success message"""
Expand Down
Loading