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
31 changes: 31 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/runloopai/api-client-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.24.0
RYE_INSTALL_OPTION: "--yes"

- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.RUNLOOP_PYPI_TOKEN || secrets.PYPI_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release Doctor
on:
pull_request:
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'runloopai/api-client-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.RUNLOOP_PYPI_TOKEN || secrets.PYPI_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0-alpha.1"
}
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog

## 0.1.0-alpha.1 (2024-06-25)

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

### Features

* **api:** OpenAPI spec update via Stainless API ([17991ec](https://github.com/runloopai/api-client-python/commit/17991ec2bd449f7ffef39a9da4b274f82c61c364))
* **api:** OpenAPI spec update via Stainless API ([a624924](https://github.com/runloopai/api-client-python/commit/a62492427ea762b1fa8e6e438ba489ff08b798e5))
* **api:** OpenAPI spec update via Stainless API ([#4](https://github.com/runloopai/api-client-python/issues/4)) ([134f28f](https://github.com/runloopai/api-client-python/commit/134f28ff63f25f18d3a4b7e2300b768ffa4c7590))
* **api:** update via SDK Studio ([88939b3](https://github.com/runloopai/api-client-python/commit/88939b3e46af521bc43a7b25e66ddb5a553a2af6))
* **api:** update via SDK Studio ([e2cca37](https://github.com/runloopai/api-client-python/commit/e2cca3796d1a2b128abb6f93b8e444f0dd4da501))


### Chores

* go live ([#2](https://github.com/runloopai/api-client-python/issues/2)) ([3ae4996](https://github.com/runloopai/api-client-python/commit/3ae4996b2474aabb19a98cf38b834ca3e91d7c2b))
* go live ([#5](https://github.com/runloopai/api-client-python/issues/5)) ([626be20](https://github.com/runloopai/api-client-python/commit/626be201c2ed40ac34f2b5869f6c17c431ee543b))
* update SDK settings ([ac8358a](https://github.com/runloopai/api-client-python/commit/ac8358ae8d3ac7ba5bab2082384ae5029c50fcc8))
* update SDK settings ([#3](https://github.com/runloopai/api-client-python/issues/3)) ([ef88178](https://github.com/runloopai/api-client-python/commit/ef88178299ae3988bc3d1e813c462d609312f69a))
* update SDK settings ([#6](https://github.com/runloopai/api-client-python/issues/6)) ([82a6f56](https://github.com/runloopai/api-client-python/commit/82a6f56061cd0ebfa88ed3ec71d044a0fb131f0a))
* update SDK settings ([#7](https://github.com/runloopai/api-client-python/issues/7)) ([aa9d69b](https://github.com/runloopai/api-client-python/commit/aa9d69b15a011dfa8381ec08327c88e5c2a1ab8d))
6 changes: 3 additions & 3 deletions 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/lib/` and `examples/` directories are exceptions and will never be overridden.
`src/runloop_minus_api_minus_client/lib/` and `examples/` directories are exceptions and will never be overridden.

## Adding and running examples

Expand All @@ -59,7 +59,7 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```bash
pip install git+ssh://git@github.com/stainless-sdks/runloop-python.git
pip install git+ssh://git@github.com/runloopai/api-client-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand Down Expand Up @@ -117,7 +117,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/runloop-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/runloopai/api-client-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
43 changes: 20 additions & 23 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.svg)](https://pypi.org/project/runloop/)
[![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 @@ -15,20 +15,17 @@ The REST API documentation can be found [on runloop.ai](https://runloop.ai). The
## Installation

```sh
# install from this staging repo
pip install git+ssh://git@github.com/stainless-sdks/runloop-python.git
# install from PyPI
pip install --pre runloop-api-client
```

> [!NOTE]
> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre runloop`

## Usage

The full API of this library can be found in [api.md](api.md).

```python
import os
from runloop import Runloop
from runloop_minus_api_minus_client import Runloop

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

client = AsyncRunloop(
# This is the default and can be omitted
Expand Down Expand Up @@ -80,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.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_minus_api_minus_client.APIConnectionError` is raised.

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

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

```python
import runloop
from runloop import Runloop
import runloop_minus_api_minus_client
from runloop_minus_api_minus_client import Runloop

client = Runloop()

try:
client.devboxes.create()
except runloop.APIConnectionError as e:
except runloop_minus_api_minus_client.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except runloop.RateLimitError as e:
except runloop_minus_api_minus_client.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except runloop.APIStatusError as e:
except runloop_minus_api_minus_client.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
Expand Down Expand Up @@ -128,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 import Runloop
from runloop_minus_api_minus_client import Runloop

# Configure the default for all requests:
client = Runloop(
Expand All @@ -146,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 import Runloop
from runloop_minus_api_minus_client import Runloop

# Configure the default for all requests:
client = Runloop(
Expand Down Expand Up @@ -196,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 import Runloop
from runloop_minus_api_minus_client import Runloop

client = Runloop()
response = client.devboxes.with_raw_response.create()
Expand All @@ -206,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/stainless-sdks/runloop-python/tree/main/src/runloop/_response.py) object.
These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/runloop-python/tree/main/src/runloop/_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_minus_api_minus_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 @@ -270,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 import Runloop, DefaultHttpxClient
from runloop_minus_api_minus_client import Runloop, DefaultHttpxClient

client = Runloop(
# Or use the `RUNLOOP_BASE_URL` env var
Expand All @@ -296,7 +293,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/runloop-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/runloopai/api-client-python/issues) with questions, bugs, or suggestions.

## Requirements

Expand Down
Loading