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.12.2"
".": "0.12.3"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 0.12.3 (2026-01-06)

Full Changelog: [v0.12.2...v0.12.3](https://github.com/openlayer-ai/openlayer-python/compare/v0.12.2...v0.12.3)

### Bug Fixes

* ensure streams are always closed ([d5fffe3](https://github.com/openlayer-ai/openlayer-python/commit/d5fffe39133f8462599063898c9f30f3771a1299))


### Chores

* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([222f10f](https://github.com/openlayer-ai/openlayer-python/commit/222f10f42cbcf6dd4fbec30763e254ae5a54f5ca))
* **internal:** version bump ([a47ede3](https://github.com/openlayer-ai/openlayer-python/commit/a47ede3204f87f368031b80bab0b6752a21a62a1))
* update lockfile ([b50033b](https://github.com/openlayer-ai/openlayer-python/commit/b50033b859ea09391e6f06615308a527c2d58312))

## 0.12.2 (2026-01-06)

Full Changelog: [v0.12.1...v0.12.2](https://github.com/openlayer-ai/openlayer-python/compare/v0.12.1...v0.12.2)
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[project]
name = "openlayer"
version = "0.12.2"
version = "0.12.3"
description = "The official Python library for the openlayer API"
dynamic = ["readme"]
license = "Apache-2.0"
authors = [
{ name = "Openlayer", email = "support@openlayer.com" },
]

dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"pandas; python_version >= '3.7'",
"pyarrow>=15.0.2,<=17.0.0; python_version == '3.8'",
"pyarrow>=18.0.0; python_version >= '3.9'",
Expand All @@ -22,6 +23,7 @@ dependencies = [
"tqdm",
"wrapt>=1.14.0"
]

requires-python = ">= 3.9"
classifiers = [
"Typing :: Typed",
Expand Down Expand Up @@ -53,7 +55,7 @@ managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright==1.1.399",
"mypy",
"mypy==1.17",
"respx",
"pytest",
"pytest-asyncio",
Expand Down
4 changes: 3 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mdurl==0.1.2
multidict==6.5.0
# via aiohttp
# via yarl
mypy==1.14.1
mypy==1.17.0
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
Expand All @@ -87,6 +87,8 @@ numpy==1.26.4
packaging==23.2
# via nox
# via pytest
pathspec==0.12.1
# via mypy
pandas==2.2.2
# via openlayer
platformdirs==3.11.0
Expand Down
8 changes: 4 additions & 4 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ pandas==2.2.2
propcache==0.3.2
# via aiohttp
# via yarl
pydantic==2.11.9
pydantic==2.12.5
# via openlayer
pydantic-core==2.33.2
pydantic-core==2.41.5
# via pydantic
python-dateutil==2.9.0.post0
# via pandas
Expand All @@ -84,14 +84,14 @@ sniffio==1.3.0
# via openlayer
tqdm==4.67.1
# via openlayer
typing-extensions==4.12.2
typing-extensions==4.15.0
# via anyio
# via multidict
# via openlayer
# via pydantic
# via pydantic-core
# via typing-inspection
typing-inspection==0.4.1
typing-inspection==0.4.2
# via pydantic
yarl==1.20.0
tzdata==2024.1
Expand Down
22 changes: 12 additions & 10 deletions src/openlayer/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()

for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# As we might not fully consume the response stream, we need to close it explicitly
response.close()
try:
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
response.close()

def __enter__(self) -> Self:
return self
Expand Down Expand Up @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()

async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()
try:
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
await response.aclose()

async def __aenter__(self) -> Self:
return self
Expand Down
2 changes: 1 addition & 1 deletion src/openlayer/_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__ = "openlayer"
__version__ = "0.12.2" # x-release-please-version
__version__ = "0.12.3" # x-release-please-version