Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d9528d6
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
382486c
feat(api): api update
stainless-app[bot] Jul 7, 2025
90fc2e5
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
05a0bcf
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
8d47022
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
d5a15da
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 11, 2025
bd53e69
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 12, 2025
8769bb2
feat: clean up environment call outs
stainless-app[bot] Jul 15, 2025
13c6372
fix(parsing): ignore empty metadata
stainless-app[bot] Jul 22, 2025
7d02baf
fix(parsing): parse extra field types
stainless-app[bot] Jul 23, 2025
0166e57
chore(project): add settings file for vscode
stainless-app[bot] Jul 25, 2025
1087c71
feat(client): support file upload requests
stainless-app[bot] Jul 31, 2025
aa45f88
chore(internal): fix ruff target version
stainless-app[bot] Aug 6, 2025
bba0d03
chore: update @stainless-api/prism-cli to v5.15.0
stainless-app[bot] Aug 9, 2025
0035775
chore(internal): update comment in script
stainless-app[bot] Aug 9, 2025
343e3ec
chore: update github action
stainless-app[bot] Aug 22, 2025
0d557ec
chore(internal): change ci workflow machines
stainless-app[bot] Aug 26, 2025
9a18d40
fix: avoid newer type syntax
stainless-app[bot] Aug 27, 2025
e031abb
chore(internal): update pyright exclude list
stainless-app[bot] Aug 27, 2025
746903b
release: 0.13.0
stainless-app[bot] Aug 27, 2025
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
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,40 @@ jobs:
- name: Run lints
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/riza-api-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
timeout-minutes: 10
name: upload
name: build
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
runs-on: ${{ github.repository == 'stainless-sdks/riza-api-python' && 'depot-ubuntu-24.04' || '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.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: rye sync --all-features

- name: Run build
run: rye build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/riza-api-python'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/riza-api-python'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.prism.log
.vscode
_dev

__pycache__
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.12.0"
".": "0.13.0"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.importFormat": "relative",
}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 0.13.0 (2025-08-27)

Full Changelog: [v0.12.0...v0.13.0](https://github.com/riza-io/riza-api-python/compare/v0.12.0...v0.13.0)

### Features

* **api:** api update ([382486c](https://github.com/riza-io/riza-api-python/commit/382486c74c65eea1194720b45ece9591d4d41af3))
* clean up environment call outs ([8769bb2](https://github.com/riza-io/riza-api-python/commit/8769bb2c3c2c1f27f9b3376784e6aea508605f06))
* **client:** support file upload requests ([1087c71](https://github.com/riza-io/riza-api-python/commit/1087c71fb0bf395b432d4fc431ee6603692e4136))


### Bug Fixes

* avoid newer type syntax ([9a18d40](https://github.com/riza-io/riza-api-python/commit/9a18d4006f1bf12a65155058c38a350d50f54c4d))
* **client:** don't send Content-Type header on GET requests ([bd53e69](https://github.com/riza-io/riza-api-python/commit/bd53e69b195f87bde9d7fb9e5d0b53e1c6fe8115))
* **parsing:** correctly handle nested discriminated unions ([8d47022](https://github.com/riza-io/riza-api-python/commit/8d47022a13eee3e79257a1b5f05fb5f1c011356d))
* **parsing:** ignore empty metadata ([13c6372](https://github.com/riza-io/riza-api-python/commit/13c637238f21a0e1d107ef93ff68aa64544d80b4))
* **parsing:** parse extra field types ([7d02baf](https://github.com/riza-io/riza-api-python/commit/7d02baf3b6f9b21004709680918f988e39b1c67e))


### Chores

* **ci:** change upload type ([d9528d6](https://github.com/riza-io/riza-api-python/commit/d9528d63ccb73418a25fd4faf7780503e59effb9))
* **internal:** bump pinned h11 dep ([90fc2e5](https://github.com/riza-io/riza-api-python/commit/90fc2e5f508cfafe32e4c01aeb47ff48d2cf97a5))
* **internal:** change ci workflow machines ([0d557ec](https://github.com/riza-io/riza-api-python/commit/0d557ec5e70c449738f311582b5816fc356baa47))
* **internal:** fix ruff target version ([aa45f88](https://github.com/riza-io/riza-api-python/commit/aa45f883a7987c82ac55f32c0cd574df06e51a30))
* **internal:** update comment in script ([0035775](https://github.com/riza-io/riza-api-python/commit/003577545ff551df4172905dba95d7375ef91416))
* **internal:** update pyright exclude list ([e031abb](https://github.com/riza-io/riza-api-python/commit/e031abb28b1171dac9169607d11b7153a326fd95))
* **package:** mark python 3.13 as supported ([05a0bcf](https://github.com/riza-io/riza-api-python/commit/05a0bcf5f142708df85b1cb43629440f17425286))
* **project:** add settings file for vscode ([0166e57](https://github.com/riza-io/riza-api-python/commit/0166e5774e72bcea4a532baafecb1ad513883616))
* **readme:** fix version rendering on pypi ([d5a15da](https://github.com/riza-io/riza-api-python/commit/d5a15daab691ce39320b92570cb03e05500f9553))
* update @stainless-api/prism-cli to v5.15.0 ([bba0d03](https://github.com/riza-io/riza-api-python/commit/bba0d03cb1b6bdd875c1683073f1bd63211b7067))
* update github action ([343e3ec](https://github.com/riza-io/riza-api-python/commit/343e3ec7a6bf8cb4bc9dccdae89a5e41d0fe178c))

## 0.12.0 (2025-06-29)

Full Changelog: [v0.11.0...v0.12.0](https://github.com/riza-io/riza-api-python/compare/v0.11.0...v0.12.0)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Riza Python API library

[![PyPI version](<https://img.shields.io/pypi/v/rizaio.svg?label=pypi%20(stable)>)](https://pypi.org/project/rizaio/)
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/rizaio.svg?label=pypi%20(stable))](https://pypi.org/project/rizaio/)

The Riza Python library provides convenient access to the Riza REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -84,15 +85,14 @@ pip install rizaio[aiohttp]
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import os
import asyncio
from rizaio import DefaultAioHttpClient
from rizaio import AsyncRiza


async def main() -> None:
async with AsyncRiza(
api_key=os.environ.get("RIZA_API_KEY"), # This is the default and can be omitted
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
response = await client.command.exec(
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rizaio"
version = "0.12.0"
version = "0.13.0"
description = "The official Python library for the riza API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
Expand All @@ -38,7 +39,7 @@ Homepage = "https://github.com/riza-io/riza-api-python"
Repository = "https://github.com/riza-io/riza-api-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]

[tool.rye]
managed = true
Expand Down Expand Up @@ -147,6 +148,7 @@ exclude = [
"_dev",
".venv",
".nox",
".git",
]

reportImplicitOverride = true
Expand All @@ -158,7 +160,7 @@ reportPrivateUsage = false
[tool.ruff]
line-length = 120
output-format = "grouped"
target-version = "py37"
target-version = "py38"

[tool.ruff.format]
docstring-code-format = true
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ filelock==3.12.4
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via respx
# via rizaio
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via rizaio
idna==3.4
# via anyio
Expand Down
6 changes: 3 additions & 3 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ exceptiongroup==1.2.2
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via rizaio
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via rizaio
idna==3.4
# via anyio
Expand Down
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
Expand All @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
fi
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ elif ! prism_is_running ; then
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
Expand Down
12 changes: 7 additions & 5 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -exuo pipefail

RESPONSE=$(curl -X POST "$URL" \
FILENAME=$(basename dist/*.whl)

RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

Expand All @@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)
UPLOAD_RESPONSE=$(curl -v -X PUT \
-H "Content-Type: binary/octet-stream" \
--data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/riza-api-python/$SHA'\033[0m"
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/riza-api-python/$SHA/$FILENAME'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
Expand Down
14 changes: 12 additions & 2 deletions src/rizaio/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,18 @@ def _build_request(
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}

is_body_allowed = options.method.lower() != "get"

if is_body_allowed:
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)
kwargs.pop("data", None)

# TODO: report this error to httpx
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
headers=headers,
Expand All @@ -540,8 +552,6 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)

Expand Down
8 changes: 4 additions & 4 deletions src/rizaio/_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
Loading