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.53.0"
".": "0.54.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 92
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8805efc665011161897e5c4c326dc44090ae55471a36bef8d63d17fec4e289f1.yml
openapi_spec_hash: 4d348158fc0b5daa3f55d831301859e4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-20da49cddb76a81f77844447916c6d445b25634ff99aae15d8dfd50fe6d854e6.yml
openapi_spec_hash: 2097a1bfb48092ed3b03fa606f5c5447
config_hash: 60681f589a9e641fdb7f19af2021a033
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.54.0 (2025-08-05)

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

### Features

* **api:** api update ([9d40ca4](https://github.com/runloopai/api-client-python/commit/9d40ca48745596ae2fa29ea3ad7fba93961eb801))
* **client:** support file upload requests ([5742a4b](https://github.com/runloopai/api-client-python/commit/5742a4ba701938607996b278531234121f81776d))

## 0.53.0 (2025-07-30)

Full Changelog: [v0.52.0...v0.53.0](https://github.com/runloopai/api-client-python/compare/v0.52.0...v0.53.0)
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.53.0"
version = "0.54.0"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down
5 changes: 4 additions & 1 deletion src/runloop_api_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ def _build_request(
is_body_allowed = options.method.lower() != "get"

if is_body_allowed:
kwargs["json"] = json_data if is_given(json_data) else None
if isinstance(json_data, bytes):
kwargs["content"] = json_data
else:
kwargs["json"] = json_data if is_given(json_data) else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)
Expand Down
8 changes: 4 additions & 4 deletions src/runloop_api_client/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], _read_file_content(file[1]), *file[2:])
return (file[0], read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


def _read_file_content(file: FileContent) -> HttpxFileContent:
def read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return pathlib.Path(file).read_bytes()
return file
Expand Down Expand Up @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], await _async_read_file_content(file[1]), *file[2:])
return (file[0], await async_read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return await anyio.Path(file).read_bytes()

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.53.0" # x-release-please-version
__version__ = "0.54.0" # x-release-please-version
40 changes: 20 additions & 20 deletions src/runloop_api_client/resources/benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create(
name: str,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: List[str] | NotGiven = NOT_GIVEN,
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
scenario_ids: Optional[List[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.
Expand All @@ -92,9 +92,9 @@ def create(
required_environment_variables: Environment variables required to run the benchmark. If any required variables
are not supplied, the benchmark will fail to start

required_secrets: Secrets required to run the benchmark with (user secret name will be mapped to
benchmark required secret name). If any of these secrets are not provided or the
mapping is incorrect, the benchmark will fail to start.
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
mapped to the your user secret by name). If any of these secrets are not
provided or the mapping is incorrect, the benchmark will fail to start.

scenario_ids: The Scenario IDs that make up the Benchmark.

Expand All @@ -115,7 +115,7 @@ def create(
"name": name,
"metadata": metadata,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scenario_ids": scenario_ids,
},
benchmark_create_params.BenchmarkCreateParams,
Expand Down Expand Up @@ -170,7 +170,7 @@ def update(
name: str,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: List[str] | NotGiven = NOT_GIVEN,
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
scenario_ids: Optional[List[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.
Expand All @@ -191,9 +191,9 @@ def update(
required_environment_variables: Environment variables required to run the benchmark. If any required variables
are not supplied, the benchmark will fail to start

required_secrets: Secrets required to run the benchmark with (user secret name will be mapped to
benchmark required secret name). If any of these secrets are not provided or the
mapping is incorrect, the benchmark will fail to start.
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
mapped to the your user secret by name). If any of these secrets are not
provided or the mapping is incorrect, the benchmark will fail to start.

scenario_ids: The Scenario IDs that make up the Benchmark.

Expand All @@ -216,7 +216,7 @@ def update(
"name": name,
"metadata": metadata,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scenario_ids": scenario_ids,
},
benchmark_update_params.BenchmarkUpdateParams,
Expand Down Expand Up @@ -463,7 +463,7 @@ async def create(
name: str,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: List[str] | NotGiven = NOT_GIVEN,
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
scenario_ids: Optional[List[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.
Expand All @@ -484,9 +484,9 @@ async def create(
required_environment_variables: Environment variables required to run the benchmark. If any required variables
are not supplied, the benchmark will fail to start

required_secrets: Secrets required to run the benchmark with (user secret name will be mapped to
benchmark required secret name). If any of these secrets are not provided or the
mapping is incorrect, the benchmark will fail to start.
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
mapped to the your user secret by name). If any of these secrets are not
provided or the mapping is incorrect, the benchmark will fail to start.

scenario_ids: The Scenario IDs that make up the Benchmark.

Expand All @@ -507,7 +507,7 @@ async def create(
"name": name,
"metadata": metadata,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scenario_ids": scenario_ids,
},
benchmark_create_params.BenchmarkCreateParams,
Expand Down Expand Up @@ -562,7 +562,7 @@ async def update(
name: str,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: List[str] | NotGiven = NOT_GIVEN,
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
scenario_ids: Optional[List[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.
Expand All @@ -583,9 +583,9 @@ async def update(
required_environment_variables: Environment variables required to run the benchmark. If any required variables
are not supplied, the benchmark will fail to start

required_secrets: Secrets required to run the benchmark with (user secret name will be mapped to
benchmark required secret name). If any of these secrets are not provided or the
mapping is incorrect, the benchmark will fail to start.
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
mapped to the your user secret by name). If any of these secrets are not
provided or the mapping is incorrect, the benchmark will fail to start.

scenario_ids: The Scenario IDs that make up the Benchmark.

Expand All @@ -608,7 +608,7 @@ async def update(
"name": name,
"metadata": metadata,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scenario_ids": scenario_ids,
},
benchmark_update_params.BenchmarkUpdateParams,
Expand Down
40 changes: 0 additions & 40 deletions src/runloop_api_client/resources/devboxes/devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,7 @@ def upload_file(
id: str,
*,
path: str,
chmod: Optional[str] | NotGiven = NOT_GIVEN,
file: FileTypes | NotGiven = NOT_GIVEN,
owner: 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,
Expand All @@ -1282,12 +1280,6 @@ def upload_file(
path: The path to write the file to on the Devbox. Path is relative to user home
directory.

chmod: File permissions in octal format (e.g., "644", "1755"). Optional. If not
specified, default system permissions will be used.

owner: File owner username. Optional. If not specified, the file will be owned by the
current user.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -1305,9 +1297,7 @@ def upload_file(
body = deepcopy_minimal(
{
"path": path,
"chmod": chmod,
"file": file,
"owner": owner,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
Expand Down Expand Up @@ -1335,8 +1325,6 @@ def write_file_contents(
*,
contents: str,
file_path: str,
chmod: Optional[str] | NotGiven = NOT_GIVEN,
owner: 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,
Expand All @@ -1356,12 +1344,6 @@ def write_file_contents(
file_path: The path to write the file to on the Devbox. Path is relative to user home
directory.

chmod: File permissions in octal format (e.g., "644", "1755"). Optional. If not
specified, default system permissions will be used.

owner: File owner username. Optional. If not specified, the file will be owned by the
current user.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -1382,8 +1364,6 @@ def write_file_contents(
{
"contents": contents,
"file_path": file_path,
"chmod": chmod,
"owner": owner,
},
devbox_write_file_contents_params.DevboxWriteFileContentsParams,
),
Expand Down Expand Up @@ -2515,9 +2495,7 @@ async def upload_file(
id: str,
*,
path: str,
chmod: Optional[str] | NotGiven = NOT_GIVEN,
file: FileTypes | NotGiven = NOT_GIVEN,
owner: 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,
Expand All @@ -2536,12 +2514,6 @@ async def upload_file(
path: The path to write the file to on the Devbox. Path is relative to user home
directory.

chmod: File permissions in octal format (e.g., "644", "1755"). Optional. If not
specified, default system permissions will be used.

owner: File owner username. Optional. If not specified, the file will be owned by the
current user.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -2559,9 +2531,7 @@ async def upload_file(
body = deepcopy_minimal(
{
"path": path,
"chmod": chmod,
"file": file,
"owner": owner,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
Expand Down Expand Up @@ -2589,8 +2559,6 @@ async def write_file_contents(
*,
contents: str,
file_path: str,
chmod: Optional[str] | NotGiven = NOT_GIVEN,
owner: 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,
Expand All @@ -2610,12 +2578,6 @@ async def write_file_contents(
file_path: The path to write the file to on the Devbox. Path is relative to user home
directory.

chmod: File permissions in octal format (e.g., "644", "1755"). Optional. If not
specified, default system permissions will be used.

owner: File owner username. Optional. If not specified, the file will be owned by the
current user.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -2636,8 +2598,6 @@ async def write_file_contents(
{
"contents": contents,
"file_path": file_path,
"chmod": chmod,
"owner": owner,
},
devbox_write_file_contents_params.DevboxWriteFileContentsParams,
),
Expand Down
12 changes: 6 additions & 6 deletions src/runloop_api_client/resources/scenarios/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def update(
name: Optional[str] | NotGiven = NOT_GIVEN,
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
scoring_contract: Optional[ScoringContractUpdateParam] | 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.
Expand Down Expand Up @@ -234,7 +234,7 @@ def update(

required_environment_variables: Environment variables required to run the scenario.

required_secrets: Secrets required to run the scenario.
required_secret_names: Secrets required to run the scenario.

scoring_contract: The scoring contract for the Scenario.

Expand All @@ -260,7 +260,7 @@ def update(
"name": name,
"reference_output": reference_output,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scoring_contract": scoring_contract,
},
scenario_update_params.ScenarioUpdateParams,
Expand Down Expand Up @@ -650,7 +650,7 @@ async def update(
name: Optional[str] | NotGiven = NOT_GIVEN,
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secrets: Optional[List[str]] | NotGiven = NOT_GIVEN,
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
scoring_contract: Optional[ScoringContractUpdateParam] | 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.
Expand Down Expand Up @@ -680,7 +680,7 @@ async def update(

required_environment_variables: Environment variables required to run the scenario.

required_secrets: Secrets required to run the scenario.
required_secret_names: Secrets required to run the scenario.

scoring_contract: The scoring contract for the Scenario.

Expand All @@ -706,7 +706,7 @@ async def update(
"name": name,
"reference_output": reference_output,
"required_environment_variables": required_environment_variables,
"required_secrets": required_secrets,
"required_secret_names": required_secret_names,
"scoring_contract": scoring_contract,
},
scenario_update_params.ScenarioUpdateParams,
Expand Down
Loading