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 .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

USER vscode

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

RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.35.0'
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
Expand All @@ -42,7 +42,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.35.0'
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Bootstrap
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.35.0'
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Publish to PyPI
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.26.0"
".": "0.27.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ccbc7c04012cbcca678f13e39f66bb770b8b3a9d6f1815ce1b9c20fee099128.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1c6045460c43f65b30ffcef9f707e8d71dca568bf8d208347a6046a6f03ff239.yml
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.27.0 (2025-03-21)

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

### Features

* **api:** api update ([#573](https://github.com/runloopai/api-client-python/issues/573)) ([091f833](https://github.com/runloopai/api-client-python/commit/091f833d80096bb0470d505c0a0145648e52819b))


### Bug Fixes

* **ci:** ensure pip is always available ([#571](https://github.com/runloopai/api-client-python/issues/571)) ([ddb9362](https://github.com/runloopai/api-client-python/commit/ddb93629704f116cafb2123dc8b302ddff883bb8))
* **ci:** remove publishing patch ([#572](https://github.com/runloopai/api-client-python/issues/572)) ([c71815a](https://github.com/runloopai/api-client-python/commit/c71815aaaf47e404e1bf3d44c6b26b5ed0b05054))
* **types:** handle more discriminated union shapes ([#570](https://github.com/runloopai/api-client-python/issues/570)) ([297cfbe](https://github.com/runloopai/api-client-python/commit/297cfbe93bfdcbbafd44a4501d5a81a7fb1651bd))


### Chores

* **internal:** bump rye to 0.44.0 ([#569](https://github.com/runloopai/api-client-python/issues/569)) ([dd5b79a](https://github.com/runloopai/api-client-python/commit/dd5b79a221fff5b38fdbd655d78254fe7140fd73))
* **internal:** remove extra empty newlines ([#567](https://github.com/runloopai/api-client-python/issues/567)) ([49f34bd](https://github.com/runloopai/api-client-python/commit/49f34bd0b733f2a10592fff098d379501df3ac86))


### Documentation

* revise readme docs about nested params ([#564](https://github.com/runloopai/api-client-python/issues/564)) ([a2df5d3](https://github.com/runloopai/api-client-python/commit/a2df5d3c9b32ab941ee83d3f5cac8b874b7bbe28))

## 0.26.0 (2025-03-04)

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

## Nested params

Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from runloop_api_client import Runloop

client = Runloop()

blueprint_view = client.blueprints.create(
name="name",
launch_parameters={
"after_idle": {
"idle_time_seconds": 0,
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
},
)
print(blueprint_view.launch_parameters)
```

## 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)`.
Expand Down
3 changes: 0 additions & 3 deletions bin/publish-pypi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
set -eux
mkdir -p dist
rye build --clean
# Patching importlib-metadata version until upstream library version is updated
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
rye publish --yes --token=$PYPI_TOKEN
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "runloop_api_client"
version = "0.26.0"
version = "0.27.0"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down Expand Up @@ -38,7 +38,6 @@ Homepage = "https://github.com/runloopai/api-client-python"
Repository = "https://github.com/runloopai/api-client-python"



[tool.rye]
managed = true
# version pins are in requirements-dev.lock
Expand Down Expand Up @@ -87,7 +86,7 @@ typecheck = { chain = [
"typecheck:mypy" = "mypy ."

[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"]
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[tool.hatch.build]
Expand Down Expand Up @@ -152,7 +151,6 @@ reportImplicitOverride = true
reportImportCycles = false
reportPrivateUsage = false


[tool.ruff]
line-length = 120
output-format = "grouped"
Expand Down
2 changes: 2 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ else
echo
fi

export DEFER_PYDANTIC_BUILD=false

echo "==> Running tests"
rye run pytest "$@"

Expand Down
7 changes: 5 additions & 2 deletions src/runloop_api_client/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from ._constants import RAW_RESPONSE_HEADER

if TYPE_CHECKING:
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema

__all__ = ["BaseModel", "GenericModel"]

Expand Down Expand Up @@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,

def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
schema = model.__pydantic_core_schema__
if schema["type"] == "definitions":
schema = schema["schema"]

if schema["type"] != "model":
return None

schema = cast("ModelSchema", schema)
fields_schema = schema["schema"]
if fields_schema["type"] != "model-fields":
return None

fields_schema = cast("ModelFieldsSchema", fields_schema)

field = fields_schema["fields"].get(field_name)
if not field:
return 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.26.0" # x-release-please-version
__version__ = "0.27.0" # x-release-please-version
12 changes: 8 additions & 4 deletions src/runloop_api_client/resources/scenarios/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ def complete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioRunView:
"""
Complete a currently running ScenarioRun.
"""Complete a currently running ScenarioRun.

Calling complete will shutdown
underlying Devbox resource.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -467,8 +469,10 @@ async def complete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioRunView:
"""
Complete a currently running ScenarioRun.
"""Complete a currently running ScenarioRun.

Calling complete will shutdown
underlying Devbox resource.

Args:
extra_headers: Send extra headers
Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/benchmark_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class BenchmarkListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/benchmark_run_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class BenchmarkRunListView(BaseModel):
has_more: bool

remaining_count: int

runs: List[BenchmarkRunView]
"""List of BenchmarkRuns matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/blueprint_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class BlueprintListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/devbox_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class DevboxListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/devbox_snapshot_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class DevboxSnapshotListView(BaseModel):
has_more: bool

remaining_count: int

snapshots: List[DevboxSnapshotView]
"""List of snapshots matching filter."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class RepositoryConnectionListView(BaseModel):
has_more: bool

remaining_count: int

repositories: List[RepositoryConnectionView]
"""List of repositories matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/scenario_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class ScenarioListView(BaseModel):
has_more: bool

remaining_count: int

scenarios: List[ScenarioView]
"""List of Scenarios matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/scenario_run_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class ScenarioRunListView(BaseModel):
has_more: bool

remaining_count: int

runs: List[ScenarioRunView]
"""List of ScenarioRuns matching filter."""

Expand Down
22 changes: 3 additions & 19 deletions src/runloop_api_client/types/scoring_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional

from .._models import BaseModel

Expand All @@ -11,29 +10,14 @@ class ScoringFunction(BaseModel):
name: str
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""

type: str
"""Type of the scoring function.
scoring_function: ScoringFunction
"""The scoring function to use for evaluating this scenario.

Use 'bash' as type and fill out 'bash_script' field for scoring via custom bash
scripts. Otherwise use a type corresponding to a custom scorer function or a
public Runloop scorer type.
The type field determines which built-in function to use.
"""

weight: float
"""Weight to apply to scoring function score.

Weights of all scoring functions should sum to 1.0.
"""

bash_script: Optional[str] = None
"""
A single bash script that sets up the environment, scores, and prints the final
score to standard out. Score should be a float between 0.0 and 1.0, and look
like "score=[0.0..1.0].
"""

scorer_params: Optional[object] = None
"""
Additional JSON structured context to pass to the scoring function if using
custom scorer.
"""
Loading
Loading