Skip to content

Commit

Permalink
chore: go live (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Sep 16, 2024
1 parent 329a9ff commit c77b954
Show file tree
Hide file tree
Showing 16 changed files with 235 additions and 60 deletions.
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/runwayml/sdk-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.35.0'
RYE_INSTALL_OPTION: '--yes'

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

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'runwayml/sdk-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.RUNWAYML_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.0.1-alpha.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: 3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-0f66f9e1d151b4f957cba43f88b83bdcae6fa931269b549aec14848624a610ee.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-00c8db8bba8ad66c20debdbe1bb3e56123c3e9162f9310c49f1f5d748a40b96b.yml
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]/stainless-sdks/runwayml-python.git
pip install git+ssh://[email protected]/runwayml/sdk-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/runwayml-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/runwayml/sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ It is generated with [Stainless](https://www.stainlessapi.com/).

## Documentation

The REST API documentation can be found on [docs.runwayml.com](https://docs.runwayml.com). The full API of this library can be found in [api.md](api.md).
The REST API documentation can be found on [dev.runwayml.com](https://dev.runwayml.com). The full API of this library can be found in [api.md](api.md).

## Installation

```sh
# install from this staging repo
pip install git+ssh://[email protected]/stainless-sdks/runwayml-python.git
# install from the production repo
pip install git+ssh://[email protected]/runwayml/sdk-python.git
```

> [!NOTE]
Expand All @@ -36,8 +36,9 @@ client = RunwayML(
)

image_to_video = client.image_to_video.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
print(image_to_video.id)
```
Expand All @@ -64,8 +65,9 @@ client = AsyncRunwayML(

async def main() -> None:
image_to_video = await client.image_to_video.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
print(image_to_video.id)

Expand Down Expand Up @@ -101,8 +103,9 @@ client = RunwayML()

try:
client.image_to_video.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
except runwayml.APIConnectionError as e:
print("The server could not be reached")
Expand Down Expand Up @@ -147,8 +150,9 @@ client = RunwayML(

# Or, configure per-request:
client.with_options(max_retries=5).image_to_video.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
```

Expand All @@ -173,8 +177,9 @@ client = RunwayML(

# Override per-request:
client.with_options(timeout=5.0).image_to_video.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
```

Expand Down Expand Up @@ -215,18 +220,19 @@ from runwayml import RunwayML

client = RunwayML()
response = client.image_to_video.with_raw_response.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
print(response.headers.get('X-My-Header'))

image_to_video = response.parse() # get the object that `image_to_video.create()` would have returned
print(image_to_video.id)
```

These methods return an [`APIResponse`](https://github.com/stainless-sdks/runwayml-python/tree/main/src/runwayml/_response.py) object.
These methods return an [`APIResponse`](https://github.com/runwayml/sdk-python/tree/main/src/runwayml/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/runwayml-python/tree/main/src/runwayml/_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/runwayml/sdk-python/tree/main/src/runwayml/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand All @@ -236,8 +242,9 @@ To stream the response body, use `.with_streaming_response` instead, which requi

```python
with client.image_to_video.with_streaming_response.create(
model="REPLACE_ME",
prompt_image="REPLACE_ME",
model="gen3a_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
) as response:
print(response.headers.get("X-My-Header"))

Expand Down Expand Up @@ -323,7 +330,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/runwayml-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/runwayml/sdk-python/issues) with questions, bugs, or suggestions.

### Determining the installed version

Expand Down
21 changes: 21 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The RUNWAYML_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ classifiers = [
]

[project.urls]
Homepage = "https://github.com/stainless-sdks/runwayml-python"
Repository = "https://github.com/stainless-sdks/runwayml-python"
Homepage = "https://github.com/runwayml/sdk-python"
Repository = "https://github.com/runwayml/sdk-python"



Expand Down Expand Up @@ -123,7 +123,7 @@ path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# replace relative links with absolute links
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/stainless-sdks/runwayml-python/tree/main/\g<2>)'
replacement = '[\1](https://github.com/runwayml/sdk-python/tree/main/\g<2>)'

[tool.black]
line-length = 120
Expand Down
66 changes: 66 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "python",
"extra-files": [
"src/runwayml/_version.py"
]
}
12 changes: 6 additions & 6 deletions src/runwayml/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
self,
*,
api_key: str | None = None,
runway_version: str | None = "2023-09-06",
runway_version: str | None = "2024-09-13",
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -92,13 +92,13 @@ def __init__(
self.api_key = api_key

if runway_version is None:
runway_version = "2023-09-06"
runway_version = "2024-09-13"
self.runway_version = runway_version

if base_url is None:
base_url = os.environ.get("RUNWAYML_BASE_URL")
if base_url is None:
base_url = f"https://playdoh.runwayml.com"
base_url = f"https://api.dev.runwayml.com"

super().__init__(
version=__version__,
Expand Down Expand Up @@ -238,7 +238,7 @@ def __init__(
self,
*,
api_key: str | None = None,
runway_version: str | None = "2023-09-06",
runway_version: str | None = "2024-09-13",
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -271,13 +271,13 @@ def __init__(
self.api_key = api_key

if runway_version is None:
runway_version = "2023-09-06"
runway_version = "2024-09-13"
self.runway_version = runway_version

if base_url is None:
base_url = os.environ.get("RUNWAYML_BASE_URL")
if base_url is None:
base_url = f"https://playdoh.runwayml.com"
base_url = f"https://api.dev.runwayml.com"

super().__init__(
version=__version__,
Expand Down
2 changes: 1 addition & 1 deletion src/runwayml/_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__ = "runwayml"
__version__ = "0.0.1-alpha.0"
__version__ = "0.0.1-alpha.0" # x-release-please-version
Loading

0 comments on commit c77b954

Please sign in to comment.