Skip to content

release: 0.25.0 #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 26, 2025
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 .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USER vscode
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH

RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
}
}
}
},
"features": {
"ghcr.io/devcontainers/features/node:1": {}
}

// Features to add to the dev container. More info: https://containers.dev/features.
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.24.0"
".": "0.25.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 77
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-cb8add05a7b418d6f8a5624be8477564853da49e8bf9671ae89b8ce49a04b6cd.yml
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ccbc7c04012cbcca678f13e39f66bb770b8b3a9d6f1815ce1b9c20fee099128.yml
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.25.0 (2025-02-26)

Full Changelog: [v0.24.0...v0.25.0](https://github.com/runloopai/api-client-python/compare/v0.24.0...v0.25.0)

### Features

* **api:** api update ([#555](https://github.com/runloopai/api-client-python/issues/555)) ([7c1d55d](https://github.com/runloopai/api-client-python/commit/7c1d55de7fe3f157a30080ddc7e7f0ea5053304a))
* **client:** allow passing `NotGiven` for body ([#553](https://github.com/runloopai/api-client-python/issues/553)) ([dc21cae](https://github.com/runloopai/api-client-python/commit/dc21caec97e15ccde2c396c6a2f0fce0f2bad313))


### Bug Fixes

* **client:** mark some request bodies as optional ([dc21cae](https://github.com/runloopai/api-client-python/commit/dc21caec97e15ccde2c396c6a2f0fce0f2bad313))


### Chores

* **internal:** codegen related update ([#551](https://github.com/runloopai/api-client-python/issues/551)) ([8dd01a1](https://github.com/runloopai/api-client-python/commit/8dd01a1e69d82ccbc4f05b72bd980d16cb93e5e5))
* **internal:** fix devcontainers setup ([#554](https://github.com/runloopai/api-client-python/issues/554)) ([9260eb4](https://github.com/runloopai/api-client-python/commit/9260eb4443fc50ecb07e99af2307896e32027158))
* **internal:** properly set __pydantic_private__ ([#556](https://github.com/runloopai/api-client-python/issues/556)) ([4496830](https://github.com/runloopai/api-client-python/commit/449683002d1fb31b01c4d167973058684b7ee654))

## 0.24.0 (2025-02-19)

Full Changelog: [v0.23.0...v0.24.0](https://github.com/runloopai/api-client-python/compare/v0.23.0...v0.24.0)
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,25 @@ for devbox in first_page.devboxes:
# Remove `await` for non-async usage.
```

## File uploads

Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.

```python
from pathlib import Path
from runloop_api_client import Runloop

client = Runloop()

client.devboxes.upload_file(
id="id",
path="path",
file=Path("/path/to/file"),
)
```

The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `runloop_api_client.APIConnectionError` is raised.
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Methods:

- <code title="post /v1/scenarios">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">create</a>(\*\*<a href="src/runloop_api_client/types/scenario_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
- <code title="get /v1/scenarios/{id}">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
- <code title="post /v1/scenarios/{id}">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">update</a>(id, \*\*<a href="src/runloop_api_client/types/scenario_update_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
- <code title="get /v1/scenarios">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">list</a>(\*\*<a href="src/runloop_api_client/types/scenario_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">SyncScenariosCursorIDPage[ScenarioView]</a></code>
- <code title="get /v1/scenarios/list_public">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">list_public</a>(\*\*<a href="src/runloop_api_client/types/scenario_list_public_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">SyncScenariosCursorIDPage[ScenarioView]</a></code>
- <code title="post /v1/scenarios/start_run">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">start_run</a>(\*\*<a href="src/runloop_api_client/types/scenario_start_run_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_run_view.py">ScenarioRunView</a></code>
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 = "runloop_api_client"
version = "0.24.0"
version = "0.25.0"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down
10 changes: 8 additions & 2 deletions src/runloop_api_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
ModelBuilderProtocol,
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import model_copy, model_dump
from ._compat import PYDANTIC_V2, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
Expand Down Expand Up @@ -207,6 +207,9 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down Expand Up @@ -292,6 +295,9 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down Expand Up @@ -518,7 +524,7 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)
Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
if not is_file_content(obj):
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
raise RuntimeError(
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/runloopai/api-client-python/tree/main#file-uploads"
) from None


Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/_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__ = "runloop_api_client"
__version__ = "0.24.0" # x-release-please-version
__version__ = "0.25.0" # x-release-please-version
157 changes: 157 additions & 0 deletions src/runloop_api_client/resources/scenarios/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from ...types import (
scenario_list_params,
scenario_create_params,
scenario_update_params,
scenario_start_run_params,
scenario_list_public_params,
)
Expand Down Expand Up @@ -183,6 +184,78 @@ def retrieve(
cast_to=ScenarioView,
)

def update(
self,
id: str,
*,
input_context: InputContextParam,
name: str,
scoring_contract: ScoringContractParam,
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
reference_output: Optional[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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioView:
"""
Update a Scenario, a repeatable AI coding evaluation test that defines the
starting environment as well as evaluation success criteria.

Args:
input_context: The input context for the Scenario.

name: Name of the scenario.

scoring_contract: The scoring contract for the Scenario.

environment_parameters: The Environment in which the Scenario will run.

metadata: User defined metadata to attach to the scenario for organization.

reference_output: A string representation of the reference output to solve the scenario. Commonly
can be the result of a git diff or a sequence of command actions to apply to the
environment.

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

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
f"/v1/scenarios/{id}",
body=maybe_transform(
{
"input_context": input_context,
"name": name,
"scoring_contract": scoring_contract,
"environment_parameters": environment_parameters,
"metadata": metadata,
"reference_output": reference_output,
},
scenario_update_params.ScenarioUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=ScenarioView,
)

def list(
self,
*,
Expand Down Expand Up @@ -532,6 +605,78 @@ async def retrieve(
cast_to=ScenarioView,
)

async def update(
self,
id: str,
*,
input_context: InputContextParam,
name: str,
scoring_contract: ScoringContractParam,
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
reference_output: Optional[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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioView:
"""
Update a Scenario, a repeatable AI coding evaluation test that defines the
starting environment as well as evaluation success criteria.

Args:
input_context: The input context for the Scenario.

name: Name of the scenario.

scoring_contract: The scoring contract for the Scenario.

environment_parameters: The Environment in which the Scenario will run.

metadata: User defined metadata to attach to the scenario for organization.

reference_output: A string representation of the reference output to solve the scenario. Commonly
can be the result of a git diff or a sequence of command actions to apply to the
environment.

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

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
f"/v1/scenarios/{id}",
body=await async_maybe_transform(
{
"input_context": input_context,
"name": name,
"scoring_contract": scoring_contract,
"environment_parameters": environment_parameters,
"metadata": metadata,
"reference_output": reference_output,
},
scenario_update_params.ScenarioUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=ScenarioView,
)

def list(
self,
*,
Expand Down Expand Up @@ -738,6 +883,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
self.retrieve = to_raw_response_wrapper(
scenarios.retrieve,
)
self.update = to_raw_response_wrapper(
scenarios.update,
)
self.list = to_raw_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -767,6 +915,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
self.retrieve = async_to_raw_response_wrapper(
scenarios.retrieve,
)
self.update = async_to_raw_response_wrapper(
scenarios.update,
)
self.list = async_to_raw_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -796,6 +947,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
self.retrieve = to_streamed_response_wrapper(
scenarios.retrieve,
)
self.update = to_streamed_response_wrapper(
scenarios.update,
)
self.list = to_streamed_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -825,6 +979,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
self.retrieve = async_to_streamed_response_wrapper(
scenarios.retrieve,
)
self.update = async_to_streamed_response_wrapper(
scenarios.update,
)
self.list = async_to_streamed_response_wrapper(
scenarios.list,
)
Expand Down
1 change: 1 addition & 0 deletions src/runloop_api_client/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from .repository_list_params import RepositoryListParams as RepositoryListParams
from .scenario_create_params import ScenarioCreateParams as ScenarioCreateParams
from .scenario_run_list_view import ScenarioRunListView as ScenarioRunListView
from .scenario_update_params import ScenarioUpdateParams as ScenarioUpdateParams
from .scoring_contract_param import ScoringContractParam as ScoringContractParam
from .scoring_function_param import ScoringFunctionParam as ScoringFunctionParam
from .benchmark_create_params import BenchmarkCreateParams as BenchmarkCreateParams
Expand Down
36 changes: 36 additions & 0 deletions src/runloop_api_client/types/scenario_update_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, Optional
from typing_extensions import Required, TypedDict

from .input_context_param import InputContextParam
from .scoring_contract_param import ScoringContractParam
from .scenario_environment_param import ScenarioEnvironmentParam

__all__ = ["ScenarioUpdateParams"]


class ScenarioUpdateParams(TypedDict, total=False):
input_context: Required[InputContextParam]
"""The input context for the Scenario."""

name: Required[str]
"""Name of the scenario."""

scoring_contract: Required[ScoringContractParam]
"""The scoring contract for the Scenario."""

environment_parameters: Optional[ScenarioEnvironmentParam]
"""The Environment in which the Scenario will run."""

metadata: Optional[Dict[str, str]]
"""User defined metadata to attach to the scenario for organization."""

reference_output: Optional[str]
"""A string representation of the reference output to solve the scenario.

Commonly can be the result of a git diff or a sequence of command actions to
apply to the environment.
"""
Loading
Loading