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.1.0-alpha.3"
".": "0.1.0-alpha.4"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.4 (2024-06-26)

Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)

### Features

* **api:** update via SDK Studio ([#15](https://github.com/runloopai/api-client-python/issues/15)) ([4813de5](https://github.com/runloopai/api-client-python/commit/4813de5f1d73df3e39a4efff76d7d80202e65162))

## 0.1.0-alpha.3 (2024-06-26)

Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ pip install -r requirements-dev.lock
## Modifying/Adding code

Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
`src/runloop_minus_api_minus_client/lib/` and `examples/` directories are exceptions and will never be overridden.
`src/runloop_api_client/lib/` and `examples/` directories are exceptions and will never be overridden.

## Adding and running examples

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Runloop Python API library

[![PyPI version](https://img.shields.io/pypi/v/runloop-api-client.svg)](https://pypi.org/project/runloop-api-client/)
[![PyPI version](https://img.shields.io/pypi/v/runloop_api_client.svg)](https://pypi.org/project/runloop_api_client/)

The Runloop Python library provides convenient access to the Runloop REST API from any Python 3.7+
application. The library includes type definitions for all request params and response fields,
Expand All @@ -16,7 +16,7 @@ The REST API documentation can be found [on runloop.ai](https://runloop.ai). The

```sh
# install from PyPI
pip install --pre runloop-api-client
pip install --pre runloop_api_client
```

## Usage
Expand All @@ -25,7 +25,7 @@ The full API of this library can be found in [api.md](api.md).

```python
import os
from runloop_minus_api_minus_client import Runloop
from runloop_api_client import Runloop

client = Runloop(
# This is the default and can be omitted
Expand All @@ -48,7 +48,7 @@ Simply import `AsyncRunloop` instead of `Runloop` and use `await` with each API
```python
import os
import asyncio
from runloop_minus_api_minus_client import AsyncRunloop
from runloop_api_client import AsyncRunloop

client = AsyncRunloop(
# This is the default and can be omitted
Expand Down Expand Up @@ -77,27 +77,27 @@ Typed requests and responses provide autocomplete and documentation within your

## 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_minus_api_minus_client.APIConnectionError` is raised.
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.

When the API returns a non-success status code (that is, 4xx or 5xx
response), a subclass of `runloop_minus_api_minus_client.APIStatusError` is raised, containing `status_code` and `response` properties.
response), a subclass of `runloop_api_client.APIStatusError` is raised, containing `status_code` and `response` properties.

All errors inherit from `runloop_minus_api_minus_client.APIError`.
All errors inherit from `runloop_api_client.APIError`.

```python
import runloop_minus_api_minus_client
from runloop_minus_api_minus_client import Runloop
import runloop_api_client
from runloop_api_client import Runloop

client = Runloop()

try:
client.devboxes.create()
except runloop_minus_api_minus_client.APIConnectionError as e:
except runloop_api_client.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except runloop_minus_api_minus_client.RateLimitError as e:
except runloop_api_client.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except runloop_minus_api_minus_client.APIStatusError as e:
except runloop_api_client.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
Expand Down Expand Up @@ -125,7 +125,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
You can use the `max_retries` option to configure or disable retry settings:

```python
from runloop_minus_api_minus_client import Runloop
from runloop_api_client import Runloop

# Configure the default for all requests:
client = Runloop(
Expand All @@ -143,7 +143,7 @@ By default requests time out after 1 minute. You can configure this with a `time
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:

```python
from runloop_minus_api_minus_client import Runloop
from runloop_api_client import Runloop

# Configure the default for all requests:
client = Runloop(
Expand Down Expand Up @@ -193,7 +193,7 @@ if response.my_field is None:
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,

```py
from runloop_minus_api_minus_client import Runloop
from runloop_api_client import Runloop

client = Runloop()
response = client.devboxes.with_raw_response.create()
Expand All @@ -203,9 +203,9 @@ devbox = response.parse() # get the object that `devboxes.create()` would have
print(devbox.id)
```

These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) object.
These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_api_client/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
The async client returns an [`AsyncAPIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_api_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand Down Expand Up @@ -267,7 +267,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
from runloop_minus_api_minus_client import Runloop, DefaultHttpxClient
from runloop_api_client import Runloop, DefaultHttpxClient

client = Runloop(
# Or use the `RUNLOOP_BASE_URL` env var
Expand Down
51 changes: 22 additions & 29 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,91 @@
# Shared Types

```python
from runloop_minus_api_minus_client.types import FunctionInvocationDetailView, ProjectLogsView
from runloop_api_client.types import FunctionInvocationDetailView, ProjectLogsView
```

# Devboxes

Types:

```python
from runloop_minus_api_minus_client.types import (
DevboxExecutionDetailView,
DevboxListView,
DevboxView,
)
from runloop_api_client.types import DevboxExecutionDetailView, DevboxListView, DevboxView
```

Methods:

- <code title="post /v1/devboxes">client.devboxes.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py">create</a>(\*\*<a href="src/runloop_minus_api_minus_client/types/devbox_create_params.py">params</a>) -> <a href="./src/runloop_minus_api_minus_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes/{id}">client.devboxes.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py">retrieve</a>(id) -> <a href="./src/runloop_minus_api_minus_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_minus_api_minus_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_minus_api_minus_client/types/devbox_list_view.py">DevboxListView</a></code>
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py">execute_sync</a>(id) -> <a href="./src/runloop_minus_api_minus_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/shutdown">client.devboxes.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py">shutdown</a>(id) -> <a href="./src/runloop_minus_api_minus_client/types/devbox_view.py">DevboxView</a></code>
- <code title="post /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">create</a>(\*\*<a href="src/runloop_api_client/types/devbox_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes/{id}">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_api_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_list_view.py">DevboxListView</a></code>
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_sync</a>(id) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/shutdown">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">shutdown</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>

## Logs

Types:

```python
from runloop_minus_api_minus_client.types.devboxes import DevboxLogsListView
from runloop_api_client.types.devboxes import DevboxLogsListView
```

Methods:

- <code title="get /v1/devboxes/{id}/logs">client.devboxes.logs.<a href="./src/runloop_minus_api_minus_client/resources/devboxes/logs.py">list</a>(id) -> <a href="./src/runloop_minus_api_minus_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>
- <code title="get /v1/devboxes/{id}/logs">client.devboxes.logs.<a href="./src/runloop_api_client/resources/devboxes/logs.py">list</a>(id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>

# Functions

Types:

```python
from runloop_minus_api_minus_client.types import FunctionListView
from runloop_api_client.types import FunctionListView
```

Methods:

- <code title="get /v1/functions">client.functions.<a href="./src/runloop_minus_api_minus_client/resources/functions/functions.py">list</a>() -> <a href="./src/runloop_minus_api_minus_client/types/function_list_view.py">FunctionListView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_async">client.functions.<a href="./src/runloop_minus_api_minus_client/resources/functions/functions.py">invoke_async</a>(function_name, \*, project_name, \*\*<a href="src/runloop_minus_api_minus_client/types/function_invoke_async_params.py">params</a>) -> <a href="./src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_sync">client.functions.<a href="./src/runloop_minus_api_minus_client/resources/functions/functions.py">invoke_sync</a>(function_name, \*, project_name, \*\*<a href="src/runloop_minus_api_minus_client/types/function_invoke_sync_params.py">params</a>) -> <a href="./src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
- <code title="get /v1/functions">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">list</a>() -> <a href="./src/runloop_api_client/types/function_list_view.py">FunctionListView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_async">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_async</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_sync">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_sync</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>

## Invocations

Types:

```python
from runloop_minus_api_minus_client.types.functions import (
FunctionInvocationListView,
KillOperationResponse,
)
from runloop_api_client.types.functions import FunctionInvocationListView, KillOperationResponse
```

Methods:

- <code title="get /v1/functions/invocations/{invocationId}">client.functions.invocations.<a href="./src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py">retrieve</a>(invocation_id) -> <a href="./src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
- <code title="get /v1/functions/invocations">client.functions.invocations.<a href="./src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py">list</a>() -> <a href="./src/runloop_minus_api_minus_client/types/functions/function_invocation_list_view.py">FunctionInvocationListView</a></code>
- <code title="post /v1/functions/invocations/{invocationId}/kill">client.functions.invocations.<a href="./src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py">kill</a>(invocation_id) -> <a href="./src/runloop_minus_api_minus_client/types/functions/kill_operation_response.py">object</a></code>
- <code title="get /v1/functions/invocations/{invocationId}">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">retrieve</a>(invocation_id) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
- <code title="get /v1/functions/invocations">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">list</a>() -> <a href="./src/runloop_api_client/types/functions/function_invocation_list_view.py">FunctionInvocationListView</a></code>
- <code title="post /v1/functions/invocations/{invocationId}/kill">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">kill</a>(invocation_id) -> <a href="./src/runloop_api_client/types/functions/kill_operation_response.py">object</a></code>

### Spans

Types:

```python
from runloop_minus_api_minus_client.types.functions.invocations import InvocationSpanListView
from runloop_api_client.types.functions.invocations import InvocationSpanListView
```

Methods:

- <code title="get /v1/functions/invocations/{invocationId}/spans">client.functions.invocations.spans.<a href="./src/runloop_minus_api_minus_client/resources/functions/invocations/spans.py">list</a>(invocation_id) -> <a href="./src/runloop_minus_api_minus_client/types/functions/invocations/invocation_span_list_view.py">InvocationSpanListView</a></code>
- <code title="get /v1/functions/invocations/{invocationId}/spans">client.functions.invocations.spans.<a href="./src/runloop_api_client/resources/functions/invocations/spans.py">list</a>(invocation_id) -> <a href="./src/runloop_api_client/types/functions/invocations/invocation_span_list_view.py">InvocationSpanListView</a></code>

# Projects

Types:

```python
from runloop_minus_api_minus_client.types import ProjectListView
from runloop_api_client.types import ProjectListView
```

Methods:

- <code title="get /v1/projects">client.projects.<a href="./src/runloop_minus_api_minus_client/resources/projects/projects.py">list</a>() -> <a href="./src/runloop_minus_api_minus_client/types/project_list_view.py">ProjectListView</a></code>
- <code title="get /v1/projects">client.projects.<a href="./src/runloop_api_client/resources/projects/projects.py">list</a>() -> <a href="./src/runloop_api_client/types/project_list_view.py">ProjectListView</a></code>

## Logs

Methods:

- <code title="get /v1/projects/{id}/logs">client.projects.logs.<a href="./src/runloop_minus_api_minus_client/resources/projects/logs.py">list</a>(id) -> <a href="./src/runloop_minus_api_minus_client/types/shared/project_logs_view.py">ProjectLogsView</a></code>
- <code title="get /v1/projects/{id}/logs">client.projects.logs.<a href="./src/runloop_api_client/resources/projects/logs.py">list</a>(id) -> <a href="./src/runloop_api_client/types/shared/project_logs_view.py">ProjectLogsView</a></code>
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ show_error_codes = True
# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/runloop_minus_api_minus_client/_files\.py|_dev/.*\.py)$
exclude = ^(src/runloop_api_client/_files\.py|_dev/.*\.py)$

strict_equality = True
implicit_reexport = True
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "runloop-api-client"
version = "0.1.0-alpha.3"
name = "runloop_api_client"
version = "0.1.0-alpha.4"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down Expand Up @@ -84,7 +84,7 @@ typecheck = { chain = [
"typecheck:mypy"
]}
"typecheck:pyright" = "pyright"
"typecheck:verify-types" = "pyright --verifytypes runloop_minus_api_minus_client --ignoreexternal"
"typecheck:verify-types" = "pyright --verifytypes runloop_api_client --ignoreexternal"
"typecheck:mypy" = "mypy ."

[build-system]
Expand All @@ -97,7 +97,7 @@ include = [
]

[tool.hatch.build.targets.wheel]
packages = ["src/runloop_minus_api_minus_client"]
packages = ["src/runloop_api_client"]

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
Expand Down Expand Up @@ -187,7 +187,7 @@ length-sort = true
length-sort-straight = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
known-first-party = ["runloop_minus_api_minus_client", "tests"]
known-first-party = ["runloop_api_client", "tests"]

[tool.ruff.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
],
"release-type": "python",
"extra-files": [
"src/runloop_minus_api_minus_client/_version.py"
"src/runloop_api_client/_version.py"
]
}
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ echo "==> Running lints"
rye run lint

echo "==> Making sure it imports"
rye run python -c 'import runloop_minus_api_minus_client'
rye run python -c 'import runloop_api_client'

Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
# Update the __module__ attribute for exported symbols so that
# error messages point to this module instead of the module
# it was originally defined in, e.g.
# runloop_minus_api_minus_client._exceptions.NotFoundError -> runloop_minus_api_minus_client.NotFoundError
# runloop_api_client._exceptions.NotFoundError -> runloop_api_client.NotFoundError
__locals = locals()
for __name in __all__:
if not __name.startswith("__"):
try:
__locals[__name].__module__ = "runloop_minus_api_minus_client"
__locals[__name].__module__ = "runloop_api_client"
except (TypeError, AttributeError):
# Some of our exported symbols are builtins which we can't set attributes for.
pass
Loading