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.8"
".": "0.1.0-alpha.9"
}
6 changes: 3 additions & 3 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-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml
openapi_spec_hash: be02256478be81fa3f649076879850bc
config_hash: eab40627b734534462ae3b8ccd8b263b
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-07d481d1498bf9677437b555e9ec2d843d50107faa7501e4c430a32b1f3c3343.yml
openapi_spec_hash: 296f78d82afbac95fad12c5eabd71f18
config_hash: 2c8351ba6611ce4a352e248405783846
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.9 (2025-05-14)

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

### Features

* **api:** update via SDK Studio ([472443c](https://github.com/onkernel/kernel-python-sdk/commit/472443c0fc689a2a1e6e5177fc74ca78e556a0d6))

## 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)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ client = Kernel(
)

response = client.apps.deploy(
entrypoint_rel_path="app.py",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand Down Expand Up @@ -63,6 +64,7 @@ client = AsyncKernel(

async def main() -> None:
response = await client.apps.deploy(
entrypoint_rel_path="app.py",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand Down Expand Up @@ -94,6 +96,7 @@ from kernel import Kernel
client = Kernel()

client.apps.deploy(
entrypoint_rel_path="app.py",
file=Path("/path/to/file"),
)
```
Expand All @@ -117,6 +120,7 @@ client = Kernel()

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

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

# Override per-request:
client.with_options(timeout=5.0).apps.deploy(
entrypoint_rel_path="app.py",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand Down Expand Up @@ -233,6 +239,7 @@ from kernel import Kernel

client = Kernel()
response = client.apps.with_raw_response.deploy(
entrypoint_rel_path="app.py",
file=b"REPLACE_ME",
version="REPLACE_ME",
)
Expand All @@ -254,6 +261,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi

```python
with client.apps.with_streaming_response.deploy(
entrypoint_rel_path="app.py",
file=b"REPLACE_ME",
version="REPLACE_ME",
) as response:
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.1.0-alpha.8"
version = "0.1.0-alpha.9"
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.8" # x-release-please-version
__version__ = "0.1.0-alpha.9" # x-release-please-version
16 changes: 8 additions & 8 deletions src/kernel/resources/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse:
def deploy(
self,
*,
entrypoint_rel_path: str,
file: FileTypes,
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,
Expand All @@ -65,10 +65,10 @@ def deploy(
Deploy a new application

Args:
file: ZIP file containing the application source directory

entrypoint_rel_path: Relative path to the entrypoint of the application

file: ZIP file containing the application source directory

force: Allow overwriting an existing app version

region: Region for deployment. Currently we only support "aws.us-east-1a"
Expand All @@ -85,8 +85,8 @@ def deploy(
"""
body = deepcopy_minimal(
{
"file": file,
"entrypoint_rel_path": entrypoint_rel_path,
"file": file,
"force": force,
"region": region,
"version": version,
Expand Down Expand Up @@ -215,8 +215,8 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse:
async def deploy(
self,
*,
entrypoint_rel_path: str,
file: FileTypes,
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,
Expand All @@ -231,10 +231,10 @@ async def deploy(
Deploy a new application

Args:
file: ZIP file containing the application source directory

entrypoint_rel_path: Relative path to the entrypoint of the application

file: ZIP file containing the application source directory

force: Allow overwriting an existing app version

region: Region for deployment. Currently we only support "aws.us-east-1a"
Expand All @@ -251,8 +251,8 @@ async def deploy(
"""
body = deepcopy_minimal(
{
"file": file,
"entrypoint_rel_path": entrypoint_rel_path,
"file": file,
"force": force,
"region": region,
"version": version,
Expand Down
6 changes: 3 additions & 3 deletions src/kernel/types/app_deploy_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@


class AppDeployParams(TypedDict, total=False):
entrypoint_rel_path: Required[Annotated[str, PropertyInfo(alias="entrypointRelPath")]]
"""Relative path to the entrypoint of the application"""

file: Required[FileTypes]
"""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"""

Expand Down
10 changes: 8 additions & 2 deletions tests/api_resources/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TestApps:
@parametrize
def test_method_deploy(self, client: Kernel) -> None:
app = client.apps.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
)
assert_matches_type(AppDeployResponse, app, path=["response"])
Expand All @@ -33,8 +34,8 @@ def test_method_deploy(self, client: Kernel) -> None:
@parametrize
def test_method_deploy_with_all_params(self, client: Kernel) -> None:
app = client.apps.deploy(
file=b"raw file contents",
entrypoint_rel_path="app.py",
file=b"raw file contents",
force="false",
region="aws.us-east-1a",
version="1.0.0",
Expand All @@ -45,6 +46,7 @@ def test_method_deploy_with_all_params(self, client: Kernel) -> None:
@parametrize
def test_raw_response_deploy(self, client: Kernel) -> None:
response = client.apps.with_raw_response.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
)

Expand All @@ -57,6 +59,7 @@ def test_raw_response_deploy(self, client: Kernel) -> None:
@parametrize
def test_streaming_response_deploy(self, client: Kernel) -> None:
with client.apps.with_streaming_response.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
) as response:
assert not response.is_closed
Expand Down Expand Up @@ -160,6 +163,7 @@ class TestAsyncApps:
@parametrize
async def test_method_deploy(self, async_client: AsyncKernel) -> None:
app = await async_client.apps.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
)
assert_matches_type(AppDeployResponse, app, path=["response"])
Expand All @@ -168,8 +172,8 @@ async def test_method_deploy(self, async_client: AsyncKernel) -> None:
@parametrize
async def test_method_deploy_with_all_params(self, async_client: AsyncKernel) -> None:
app = await async_client.apps.deploy(
file=b"raw file contents",
entrypoint_rel_path="app.py",
file=b"raw file contents",
force="false",
region="aws.us-east-1a",
version="1.0.0",
Expand All @@ -180,6 +184,7 @@ async def test_method_deploy_with_all_params(self, async_client: AsyncKernel) ->
@parametrize
async def test_raw_response_deploy(self, async_client: AsyncKernel) -> None:
response = await async_client.apps.with_raw_response.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
)

Expand All @@ -192,6 +197,7 @@ async def test_raw_response_deploy(self, async_client: AsyncKernel) -> None:
@parametrize
async def test_streaming_response_deploy(self, async_client: AsyncKernel) -> None:
async with async_client.apps.with_streaming_response.deploy(
entrypoint_rel_path="app.py",
file=b"raw file contents",
) as response:
assert not response.is_closed
Expand Down
40 changes: 30 additions & 10 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,12 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
with pytest.raises(APITimeoutError):
self.client.post(
"/apps/deploy",
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
body=cast(
object,
maybe_transform(
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
Expand All @@ -737,7 +742,12 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
with pytest.raises(APIStatusError):
self.client.post(
"/apps/deploy",
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
body=cast(
object,
maybe_transform(
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
Expand Down Expand Up @@ -770,7 +780,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = client.apps.with_raw_response.deploy(file=b"raw file contents")
response = client.apps.with_raw_response.deploy(entrypoint_rel_path="app.py", file=b"raw file contents")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -795,7 +805,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = client.apps.with_raw_response.deploy(
file=b"raw file contents", extra_headers={"x-stainless-retry-count": Omit()}
entrypoint_rel_path="app.py", file=b"raw file contents", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -820,7 +830,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = client.apps.with_raw_response.deploy(
file=b"raw file contents", extra_headers={"x-stainless-retry-count": "42"}
entrypoint_rel_path="app.py", file=b"raw file contents", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down Expand Up @@ -1513,7 +1523,12 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APITimeoutError):
await self.client.post(
"/apps/deploy",
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
body=cast(
object,
maybe_transform(
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
Expand All @@ -1529,7 +1544,12 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APIStatusError):
await self.client.post(
"/apps/deploy",
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
body=cast(
object,
maybe_transform(
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
Expand Down Expand Up @@ -1563,7 +1583,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = await client.apps.with_raw_response.deploy(file=b"raw file contents")
response = await client.apps.with_raw_response.deploy(entrypoint_rel_path="app.py", file=b"raw file contents")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -1589,7 +1609,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = await client.apps.with_raw_response.deploy(
file=b"raw file contents", extra_headers={"x-stainless-retry-count": Omit()}
entrypoint_rel_path="app.py", file=b"raw file contents", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -1615,7 +1635,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)

response = await client.apps.with_raw_response.deploy(
file=b"raw file contents", extra_headers={"x-stainless-retry-count": "42"}
entrypoint_rel_path="app.py", file=b"raw file contents", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down