Skip to content

Commit 4dc6179

Browse files
stainless-app[bot]Stainless Bot
authored andcommitted
feat(api): codegen changes
1 parent a54194f commit 4dc6179

File tree

18 files changed

+143
-134
lines changed

18 files changed

+143
-134
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
pull_request:
77
branches:
88
- main
9+
- next
910

1011
jobs:
1112
lint:
@@ -21,7 +22,7 @@ jobs:
2122
curl -sSf https://rye.astral.sh/get | bash
2223
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2324
env:
24-
RYE_VERSION: 0.24.0
25+
RYE_VERSION: '0.35.0'
2526
RYE_INSTALL_OPTION: '--yes'
2627

2728
- name: Install dependencies
@@ -41,7 +42,7 @@ jobs:
4142
curl -sSf https://rye.astral.sh/get | bash
4243
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4344
env:
44-
RYE_VERSION: 0.24.0
45+
RYE_VERSION: '0.35.0'
4546
RYE_INSTALL_OPTION: '--yes'
4647

4748
- name: Bootstrap

.github/workflows/publish-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: 0.24.0
25-
RYE_INSTALL_OPTION: "--yes"
24+
RYE_VERSION: '0.35.0'
25+
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Publish to PyPI
2828
run: |

requirements-dev.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9+
# generate-hashes: false
910

1011
-e file:.
1112
annotated-types==0.6.0
@@ -48,7 +49,7 @@ markdown-it-py==3.0.0
4849
# via rich
4950
mdurl==0.1.2
5051
# via markdown-it-py
51-
mypy==1.7.1
52+
mypy==1.10.1
5253
mypy-extensions==1.0.0
5354
# via mypy
5455
nodeenv==1.8.0

requirements.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9+
# generate-hashes: false
910

1011
-e file:.
1112
annotated-types==0.6.0

src/runloop_api_client/_base_client.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ def _request(
955955
stream: bool,
956956
stream_cls: type[_StreamT] | None,
957957
) -> ResponseT | _StreamT:
958+
# create a copy of the options we were given so that if the
959+
# options are mutated later & we then retry, the retries are
960+
# given the original options
961+
input_options = model_copy(options)
962+
958963
cast_to = self._maybe_override_cast_to(cast_to, options)
959964
self._prepare_options(options)
960965

@@ -979,7 +984,7 @@ def _request(
979984

980985
if retries > 0:
981986
return self._retry_request(
982-
options,
987+
input_options,
983988
cast_to,
984989
retries,
985990
stream=stream,
@@ -994,7 +999,7 @@ def _request(
994999

9951000
if retries > 0:
9961001
return self._retry_request(
997-
options,
1002+
input_options,
9981003
cast_to,
9991004
retries,
10001005
stream=stream,
@@ -1022,7 +1027,7 @@ def _request(
10221027
if retries > 0 and self._should_retry(err.response):
10231028
err.response.close()
10241029
return self._retry_request(
1025-
options,
1030+
input_options,
10261031
cast_to,
10271032
retries,
10281033
err.response.headers,
@@ -1518,6 +1523,11 @@ async def _request(
15181523
# execute it earlier while we are in an async context
15191524
self._platform = await asyncify(get_platform)()
15201525

1526+
# create a copy of the options we were given so that if the
1527+
# options are mutated later & we then retry, the retries are
1528+
# given the original options
1529+
input_options = model_copy(options)
1530+
15211531
cast_to = self._maybe_override_cast_to(cast_to, options)
15221532
await self._prepare_options(options)
15231533

@@ -1540,7 +1550,7 @@ async def _request(
15401550

15411551
if retries > 0:
15421552
return await self._retry_request(
1543-
options,
1553+
input_options,
15441554
cast_to,
15451555
retries,
15461556
stream=stream,
@@ -1555,7 +1565,7 @@ async def _request(
15551565

15561566
if retries > 0:
15571567
return await self._retry_request(
1558-
options,
1568+
input_options,
15591569
cast_to,
15601570
retries,
15611571
stream=stream,
@@ -1578,7 +1588,7 @@ async def _request(
15781588
if retries > 0 and self._should_retry(err.response):
15791589
await err.response.aclose()
15801590
return await self._retry_request(
1581-
options,
1591+
input_options,
15821592
cast_to,
15831593
retries,
15841594
err.response.headers,

src/runloop_api_client/_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T:
643643
return cast(_T, _validate_non_model_type(type_=type_, value=value))
644644

645645

646+
def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
647+
"""Add a pydantic config for the given type.
648+
649+
Note: this is a no-op on Pydantic v1.
650+
"""
651+
setattr(typ, "__pydantic_config__", config) # noqa: B010
652+
653+
646654
# our use of subclasssing here causes weirdness for type checkers,
647655
# so we just pretend that we don't subclass
648656
if TYPE_CHECKING:

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
async_to_raw_response_wrapper,
2929
async_to_streamed_response_wrapper,
3030
)
31-
from ..._base_client import (
32-
make_request_options,
33-
)
31+
from ..._base_client import make_request_options
3432
from ...types.devbox_view import DevboxView
3533
from ...types.devbox_list_view import DevboxListView
3634
from ...types.devbox_execution_detail_view import DevboxExecutionDetailView

src/runloop_api_client/resources/devboxes/logs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
async_to_raw_response_wrapper,
1414
async_to_streamed_response_wrapper,
1515
)
16-
from ..._base_client import (
17-
make_request_options,
18-
)
16+
from ..._base_client import make_request_options
1917
from ...types.devboxes.devbox_logs_list_view import DevboxLogsListView
2018

2119
__all__ = ["LogsResource", "AsyncLogsResource"]

src/runloop_api_client/resources/functions/functions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
InvocationsResourceWithStreamingResponse,
2727
AsyncInvocationsResourceWithStreamingResponse,
2828
)
29-
from ..._base_client import (
30-
make_request_options,
31-
)
29+
from ..._base_client import make_request_options
3230
from .invocations.invocations import InvocationsResource, AsyncInvocationsResource
3331
from ...types.function_list_view import FunctionListView
3432
from ...types.shared.function_invocation_detail_view import FunctionInvocationDetailView

0 commit comments

Comments
 (0)