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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/steel-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand All @@ -31,7 +36,7 @@ jobs:
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/steel-python'
if: github.repository == 'stainless-sdks/steel-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
timeout-minutes: 10
name: upload
permissions:
Expand All @@ -58,6 +63,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/steel-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

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.4.0"
".": "0.5.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 25
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-d5a9cdf80ea29558c755cdebab1f876a01bbb6f6e7cd480b677b8b8313d6e92c.yml
openapi_spec_hash: ac6ed4b57809802e0924cdf97ca92102
config_hash: 8fee9983d818d458fca9da01d2013f05
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-f81cef6f87adc0530d9bc21e8d47c95aadef9d5bc3c282837ae0ad41d7f71bac.yml
openapi_spec_hash: 5b273b225abb80a969ea1485bf399745
config_hash: 42515bf83f1e0e765071038fcf702122
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## 0.5.0 (2025-06-30)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/steel-dev/steel-python/compare/v0.4.0...v0.5.0)

### Features

* **api:** api update ([978ad9c](https://github.com/steel-dev/steel-python/commit/978ad9cb86523cf783ca1c059b137d497422d626))
* **client:** add support for aiohttp ([87bc6e2](https://github.com/steel-dev/steel-python/commit/87bc6e2420ea32f8336251fdda4c8353b8181f35))


### Bug Fixes

* **ci:** correct conditional ([76d9c3f](https://github.com/steel-dev/steel-python/commit/76d9c3f76a200bc1d2e567bd0bf9decebf6998cc))
* **ci:** release-doctor — report correct token name ([0500644](https://github.com/steel-dev/steel-python/commit/0500644bda4e13e3ff0975a3be3af641fb731dea))
* **client:** correctly parse binary response | stream ([96bc0a5](https://github.com/steel-dev/steel-python/commit/96bc0a57989271ac57a5e916a9678798e8bc7123))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([ffacf10](https://github.com/steel-dev/steel-python/commit/ffacf10a70b267665f65ee31aa176a2d0fdb0fca))


### Chores

* **ci:** enable for pull requests ([4f581f1](https://github.com/steel-dev/steel-python/commit/4f581f14fac853d9ffb09aac7efcd4cba8e7e008))
* **ci:** only run for pushes and fork pull requests ([51c348d](https://github.com/steel-dev/steel-python/commit/51c348d7d8d1811dbd054887b06a3a0fc582d61e))
* **internal:** update conftest.py ([95540f2](https://github.com/steel-dev/steel-python/commit/95540f26791852e6a9864e4ebe12fb8762ed0241))
* **readme:** update badges ([e210ee7](https://github.com/steel-dev/steel-python/commit/e210ee78b18dc19b9b39b67c2b37f16c855f0c58))
* **tests:** add tests for httpx client instantiation & proxies ([ad4f8a1](https://github.com/steel-dev/steel-python/commit/ad4f8a1256746d265dd9a2c0a9bfca53fa4c61f3))
* **tests:** run tests in parallel ([825c97f](https://github.com/steel-dev/steel-python/commit/825c97fc4b37a582267bf338b2640de17a254546))
* **tests:** skip some failing tests on the latest python versions ([c64047c](https://github.com/steel-dev/steel-python/commit/c64047c3036b3054f1f466f7521db5f76d013c8d))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([2c5ba6f](https://github.com/steel-dev/steel-python/commit/2c5ba6f2f450b6b7a2172ee9dfcf9de93426773b))

## 0.4.0 (2025-06-03)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/steel-dev/steel-python/compare/v0.3.0...v0.4.0)
Expand Down
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Steel Python API library

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

The Steel Python library provides convenient access to the Steel REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -64,6 +64,39 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install steel-sdk[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from steel import DefaultAioHttpClient
from steel import AsyncSteel


async def main() -> None:
async with AsyncSteel(
http_client=DefaultAioHttpClient(),
) as client:
session = await client.sessions.create(
api_timeout=20000,
use_proxy=True,
)
print(session.id)


asyncio.run(main())
```

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
Expand Down Expand Up @@ -224,7 +257,7 @@ client.with_options(max_retries=5).sessions.create()
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from steel import Steel
Expand Down
2 changes: 1 addition & 1 deletion bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
errors=()

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

lenErrors=${#errors[@]}
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "steel-sdk"
version = "0.4.0"
version = "0.5.0"
description = "The official Python library for the steel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -37,6 +37,8 @@ classifiers = [
Homepage = "https://github.com/steel-dev/steel-python"
Repository = "https://github.com/steel-dev/steel-python"

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

[tool.rye]
managed = true
Expand All @@ -54,6 +56,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

[tool.rye.scripts]
Expand Down Expand Up @@ -125,7 +128,7 @@ replacement = '[\1](https://github.com/steel-dev/steel-python/tree/main/\g<2>)'

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
addopts = "--tb=short -n auto"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
31 changes: 31 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.8
# via httpx-aiohttp
# via steel-sdk
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via steel-sdk
argcomplete==3.1.2
# via nox
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -30,25 +41,37 @@ distro==1.8.0
exceptiongroup==1.2.2
# via anyio
# via pytest
execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via respx
# via steel-sdk
httpx-aiohttp==0.1.6
# via steel-sdk
idna==3.4
# via anyio
# via httpx
# via yarl
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
multidict==6.4.4
# via aiohttp
# via yarl
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
Expand All @@ -63,6 +86,9 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
# via steel-sdk
pydantic-core==2.27.1
Expand All @@ -72,7 +98,9 @@ pygments==2.18.0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
# via pytest-xdist
pytest-asyncio==0.24.0
pytest-xdist==3.7.0
python-dateutil==2.8.2
# via time-machine
pytz==2023.3.post1
Expand All @@ -93,12 +121,15 @@ tomli==2.0.2
# via pytest
typing-extensions==4.12.2
# via anyio
# via multidict
# via mypy
# via pydantic
# via pydantic-core
# via pyright
# via steel-sdk
virtualenv==20.24.5
# via nox
yarl==1.20.0
# via aiohttp
zipp==3.17.0
# via importlib-metadata
27 changes: 27 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,51 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.8
# via httpx-aiohttp
# via steel-sdk
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via steel-sdk
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
distro==1.8.0
# via steel-sdk
exceptiongroup==1.2.2
# via anyio
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via steel-sdk
httpx-aiohttp==0.1.6
# via steel-sdk
idna==3.4
# via anyio
# via httpx
# via yarl
multidict==6.4.4
# via aiohttp
# via yarl
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
# via steel-sdk
pydantic-core==2.27.1
Expand All @@ -40,6 +64,9 @@ sniffio==1.3.0
# via steel-sdk
typing-extensions==4.12.2
# via anyio
# via multidict
# via pydantic
# via pydantic-core
# via steel-sdk
yarl==1.20.0
# via aiohttp
3 changes: 2 additions & 1 deletion src/steel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
UnprocessableEntityError,
APIResponseValidationError,
)
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging

__all__ = [
Expand Down Expand Up @@ -68,6 +68,7 @@
"DEFAULT_CONNECTION_LIMITS",
"DefaultHttpxClient",
"DefaultAsyncHttpxClient",
"DefaultAioHttpClient",
]

if not _t.TYPE_CHECKING:
Expand Down
Loading