Skip to content

Commit 952c105

Browse files
feat(api): update via SDK Studio
1 parent efa4c30 commit 952c105

File tree

6 files changed

+59
-25
lines changed

6 files changed

+59
-25
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 4
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml
3-
openapi_spec_hash: be02256478be81fa3f649076879850bc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-07d481d1498bf9677437b555e9ec2d843d50107faa7501e4c430a32b1f3c3343.yml
3+
openapi_spec_hash: 296f78d82afbac95fad12c5eabd71f18
44
config_hash: 2c8351ba6611ce4a352e248405783846

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ client = Kernel(
3434
)
3535

3636
response = client.apps.deploy(
37+
entrypoint_rel_path="app.py",
3738
file=b"REPLACE_ME",
3839
version="REPLACE_ME",
3940
)
@@ -63,6 +64,7 @@ client = AsyncKernel(
6364

6465
async def main() -> None:
6566
response = await client.apps.deploy(
67+
entrypoint_rel_path="app.py",
6668
file=b"REPLACE_ME",
6769
version="REPLACE_ME",
6870
)
@@ -94,6 +96,7 @@ from kernel import Kernel
9496
client = Kernel()
9597

9698
client.apps.deploy(
99+
entrypoint_rel_path="app.py",
97100
file=Path("/path/to/file"),
98101
)
99102
```
@@ -117,6 +120,7 @@ client = Kernel()
117120

118121
try:
119122
client.apps.deploy(
123+
entrypoint_rel_path="app.py",
120124
file=b"REPLACE_ME",
121125
version="REPLACE_ME",
122126
)
@@ -163,6 +167,7 @@ client = Kernel(
163167

164168
# Or, configure per-request:
165169
client.with_options(max_retries=5).apps.deploy(
170+
entrypoint_rel_path="app.py",
166171
file=b"REPLACE_ME",
167172
version="REPLACE_ME",
168173
)
@@ -189,6 +194,7 @@ client = Kernel(
189194

190195
# Override per-request:
191196
client.with_options(timeout=5.0).apps.deploy(
197+
entrypoint_rel_path="app.py",
192198
file=b"REPLACE_ME",
193199
version="REPLACE_ME",
194200
)
@@ -233,6 +239,7 @@ from kernel import Kernel
233239

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

255262
```python
256263
with client.apps.with_streaming_response.deploy(
264+
entrypoint_rel_path="app.py",
257265
file=b"REPLACE_ME",
258266
version="REPLACE_ME",
259267
) as response:

src/kernel/resources/apps.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse:
4949
def deploy(
5050
self,
5151
*,
52+
entrypoint_rel_path: str,
5253
file: FileTypes,
53-
entrypoint_rel_path: str | NotGiven = NOT_GIVEN,
5454
force: Literal["true", "false"] | NotGiven = NOT_GIVEN,
5555
region: Literal["aws.us-east-1a"] | NotGiven = NOT_GIVEN,
5656
version: str | NotGiven = NOT_GIVEN,
@@ -65,10 +65,10 @@ def deploy(
6565
Deploy a new application
6666
6767
Args:
68-
file: ZIP file containing the application source directory
69-
7068
entrypoint_rel_path: Relative path to the entrypoint of the application
7169
70+
file: ZIP file containing the application source directory
71+
7272
force: Allow overwriting an existing app version
7373
7474
region: Region for deployment. Currently we only support "aws.us-east-1a"
@@ -85,8 +85,8 @@ def deploy(
8585
"""
8686
body = deepcopy_minimal(
8787
{
88-
"file": file,
8988
"entrypoint_rel_path": entrypoint_rel_path,
89+
"file": file,
9090
"force": force,
9191
"region": region,
9292
"version": version,
@@ -215,8 +215,8 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse:
215215
async def deploy(
216216
self,
217217
*,
218+
entrypoint_rel_path: str,
218219
file: FileTypes,
219-
entrypoint_rel_path: str | NotGiven = NOT_GIVEN,
220220
force: Literal["true", "false"] | NotGiven = NOT_GIVEN,
221221
region: Literal["aws.us-east-1a"] | NotGiven = NOT_GIVEN,
222222
version: str | NotGiven = NOT_GIVEN,
@@ -231,10 +231,10 @@ async def deploy(
231231
Deploy a new application
232232
233233
Args:
234-
file: ZIP file containing the application source directory
235-
236234
entrypoint_rel_path: Relative path to the entrypoint of the application
237235
236+
file: ZIP file containing the application source directory
237+
238238
force: Allow overwriting an existing app version
239239
240240
region: Region for deployment. Currently we only support "aws.us-east-1a"
@@ -251,8 +251,8 @@ async def deploy(
251251
"""
252252
body = deepcopy_minimal(
253253
{
254-
"file": file,
255254
"entrypoint_rel_path": entrypoint_rel_path,
255+
"file": file,
256256
"force": force,
257257
"region": region,
258258
"version": version,

src/kernel/types/app_deploy_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212

1313
class AppDeployParams(TypedDict, total=False):
14+
entrypoint_rel_path: Required[Annotated[str, PropertyInfo(alias="entrypointRelPath")]]
15+
"""Relative path to the entrypoint of the application"""
16+
1417
file: Required[FileTypes]
1518
"""ZIP file containing the application source directory"""
1619

17-
entrypoint_rel_path: Annotated[str, PropertyInfo(alias="entrypointRelPath")]
18-
"""Relative path to the entrypoint of the application"""
19-
2020
force: Literal["true", "false"]
2121
"""Allow overwriting an existing app version"""
2222

tests/api_resources/test_apps.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class TestApps:
2525
@parametrize
2626
def test_method_deploy(self, client: Kernel) -> None:
2727
app = client.apps.deploy(
28+
entrypoint_rel_path="app.py",
2829
file=b"raw file contents",
2930
)
3031
assert_matches_type(AppDeployResponse, app, path=["response"])
@@ -33,8 +34,8 @@ def test_method_deploy(self, client: Kernel) -> None:
3334
@parametrize
3435
def test_method_deploy_with_all_params(self, client: Kernel) -> None:
3536
app = client.apps.deploy(
36-
file=b"raw file contents",
3737
entrypoint_rel_path="app.py",
38+
file=b"raw file contents",
3839
force="false",
3940
region="aws.us-east-1a",
4041
version="1.0.0",
@@ -45,6 +46,7 @@ def test_method_deploy_with_all_params(self, client: Kernel) -> None:
4546
@parametrize
4647
def test_raw_response_deploy(self, client: Kernel) -> None:
4748
response = client.apps.with_raw_response.deploy(
49+
entrypoint_rel_path="app.py",
4850
file=b"raw file contents",
4951
)
5052

@@ -57,6 +59,7 @@ def test_raw_response_deploy(self, client: Kernel) -> None:
5759
@parametrize
5860
def test_streaming_response_deploy(self, client: Kernel) -> None:
5961
with client.apps.with_streaming_response.deploy(
62+
entrypoint_rel_path="app.py",
6063
file=b"raw file contents",
6164
) as response:
6265
assert not response.is_closed
@@ -160,6 +163,7 @@ class TestAsyncApps:
160163
@parametrize
161164
async def test_method_deploy(self, async_client: AsyncKernel) -> None:
162165
app = await async_client.apps.deploy(
166+
entrypoint_rel_path="app.py",
163167
file=b"raw file contents",
164168
)
165169
assert_matches_type(AppDeployResponse, app, path=["response"])
@@ -168,8 +172,8 @@ async def test_method_deploy(self, async_client: AsyncKernel) -> None:
168172
@parametrize
169173
async def test_method_deploy_with_all_params(self, async_client: AsyncKernel) -> None:
170174
app = await async_client.apps.deploy(
171-
file=b"raw file contents",
172175
entrypoint_rel_path="app.py",
176+
file=b"raw file contents",
173177
force="false",
174178
region="aws.us-east-1a",
175179
version="1.0.0",
@@ -180,6 +184,7 @@ async def test_method_deploy_with_all_params(self, async_client: AsyncKernel) ->
180184
@parametrize
181185
async def test_raw_response_deploy(self, async_client: AsyncKernel) -> None:
182186
response = await async_client.apps.with_raw_response.deploy(
187+
entrypoint_rel_path="app.py",
183188
file=b"raw file contents",
184189
)
185190

@@ -192,6 +197,7 @@ async def test_raw_response_deploy(self, async_client: AsyncKernel) -> None:
192197
@parametrize
193198
async def test_streaming_response_deploy(self, async_client: AsyncKernel) -> None:
194199
async with async_client.apps.with_streaming_response.deploy(
200+
entrypoint_rel_path="app.py",
195201
file=b"raw file contents",
196202
) as response:
197203
assert not response.is_closed

tests/test_client.py

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,12 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
720720
with pytest.raises(APITimeoutError):
721721
self.client.post(
722722
"/apps/deploy",
723-
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
723+
body=cast(
724+
object,
725+
maybe_transform(
726+
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
727+
),
728+
),
724729
cast_to=httpx.Response,
725730
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
726731
)
@@ -735,7 +740,12 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
735740
with pytest.raises(APIStatusError):
736741
self.client.post(
737742
"/apps/deploy",
738-
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
743+
body=cast(
744+
object,
745+
maybe_transform(
746+
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
747+
),
748+
),
739749
cast_to=httpx.Response,
740750
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
741751
)
@@ -768,7 +778,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
768778

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

771-
response = client.apps.with_raw_response.deploy(file=b"raw file contents")
781+
response = client.apps.with_raw_response.deploy(entrypoint_rel_path="app.py", file=b"raw file contents")
772782

773783
assert response.retries_taken == failures_before_success
774784
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -793,7 +803,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
793803
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)
794804

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

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

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

824834
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
@@ -1510,7 +1520,12 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15101520
with pytest.raises(APITimeoutError):
15111521
await self.client.post(
15121522
"/apps/deploy",
1513-
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
1523+
body=cast(
1524+
object,
1525+
maybe_transform(
1526+
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
1527+
),
1528+
),
15141529
cast_to=httpx.Response,
15151530
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15161531
)
@@ -1525,7 +1540,12 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
15251540
with pytest.raises(APIStatusError):
15261541
await self.client.post(
15271542
"/apps/deploy",
1528-
body=cast(object, maybe_transform(dict(file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams)),
1543+
body=cast(
1544+
object,
1545+
maybe_transform(
1546+
dict(entrypoint_rel_path="app.py", file=b"REPLACE_ME", version="REPLACE_ME"), AppDeployParams
1547+
),
1548+
),
15291549
cast_to=httpx.Response,
15301550
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15311551
)
@@ -1559,7 +1579,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15591579

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

1562-
response = await client.apps.with_raw_response.deploy(file=b"raw file contents")
1582+
response = await client.apps.with_raw_response.deploy(entrypoint_rel_path="app.py", file=b"raw file contents")
15631583

15641584
assert response.retries_taken == failures_before_success
15651585
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -1585,7 +1605,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15851605
respx_mock.post("/apps/deploy").mock(side_effect=retry_handler)
15861606

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

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

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

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

0 commit comments

Comments
 (0)