Skip to content
Open
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 @@
{
".": "5.2.0"
".": "5.2.1"
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 5.2.1 (2026-02-24)

Full Changelog: [v5.2.0...v5.2.1](https://github.com/imagekit-developer/imagekit-python/compare/v5.2.0...v5.2.1)

### Chores

* **dependencies:** require standardwebhooks 1.0.1 ([f7c4465](https://github.com/imagekit-developer/imagekit-python/commit/f7c44652ef95cfa1aefef380d280036158519007))
* format all `api.md` files ([09cbb17](https://github.com/imagekit-developer/imagekit-python/commit/09cbb17e722d374477b13fd4045201ab75ddcc7e))
* **internal:** add request options to SSE classes ([c0dee43](https://github.com/imagekit-developer/imagekit-python/commit/c0dee43afe3bc1f6ea35649532594e59fb4b8953))
* **internal:** bump dependencies ([6702b4b](https://github.com/imagekit-developer/imagekit-python/commit/6702b4bcd12af1d670a4b73a7d9bedd68ccc5560))
* **internal:** fix lint error on Python 3.14 ([89d503b](https://github.com/imagekit-developer/imagekit-python/commit/89d503b2a885f57edbbd6ffded3d1cddac61a53e))
* **internal:** make `test_proxy_environment_variables` more resilient ([821dd3f](https://github.com/imagekit-developer/imagekit-python/commit/821dd3f61db9b2be3297dc1b8a9e63d257df9ed1))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([487887e](https://github.com/imagekit-developer/imagekit-python/commit/487887eb0e4c405c0f8294e6a82ef6c7a2187c5c))
* **internal:** remove mock server code ([978ed61](https://github.com/imagekit-developer/imagekit-python/commit/978ed611a909e2d616b322e23bfe3d14e8f256f4))
* update mock server docs ([54f47c6](https://github.com/imagekit-developer/imagekit-python/commit/54f47c663b48f2b6a88bf05ba26a0f2a139ee752))

## 5.2.0 (2026-02-02)

Full Changelog: [v5.1.2...v5.2.0](https://github.com/imagekit-developer/imagekit-python/compare/v5.1.2...v5.2.0)
Expand Down
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ $ pip install ./path-to-wheel-file.whl

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```sh
# you will need npm installed
$ npx prism mock path/to/your/openapi.yml
```

```sh
$ ./scripts/test
```
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "imagekitio"
version = "5.2.0"
version = "5.2.1"
description = "The official Python library for the ImageKit API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ Repository = "https://github.com/imagekit-developer/imagekit-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
webhooks = ["standardwebhooks"]
webhooks = ["standardwebhooks >= 1.0.1, < 2"]

[tool.rye]
managed = true
Expand Down Expand Up @@ -70,7 +70,7 @@ format = { chain = [
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'"
"format:ruff" = "ruff format"

"lint" = { chain = [
Expand Down
22 changes: 11 additions & 11 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.13.2
aiohttp==3.13.3
# via httpx-aiohttp
# via imagekitio
aiosignal==1.4.0
# via aiohttp
annotated-types==0.7.0
# via pydantic
anyio==4.12.0
anyio==4.12.1
# via httpx
# via imagekitio
argcomplete==3.6.3
Expand All @@ -32,7 +32,7 @@ attrs==25.4.0
# via standardwebhooks
backports-asyncio-runner==1.2.0
# via pytest-asyncio
certifi==2025.11.12
certifi==2026.1.4
# via httpcore
# via httpx
colorlog==6.10.1
Expand Down Expand Up @@ -65,15 +65,15 @@ httpx==0.28.1
# via imagekitio
# via respx
# via standardwebhooks
httpx-aiohttp==0.1.9
httpx-aiohttp==0.1.12
# via imagekitio
humanize==4.13.0
# via nox
idna==3.11
# via anyio
# via httpx
# via yarl
importlib-metadata==8.7.0
importlib-metadata==8.7.1
iniconfig==2.1.0
# via pytest
markdown-it-py==3.0.0
Expand All @@ -86,14 +86,14 @@ multidict==6.7.0
mypy==1.17.0
mypy-extensions==1.1.0
# via mypy
nodeenv==1.9.1
nodeenv==1.10.0
# via pyright
nox==2025.11.12
packaging==25.0
# via dependency-groups
# via nox
# via pytest
pathspec==0.12.1
pathspec==1.0.3
# via mypy
platformdirs==4.4.0
# via virtualenv
Expand All @@ -120,15 +120,15 @@ python-dateutil==2.9.0.post0
# via time-machine
respx==0.22.0
rich==14.2.0
ruff==0.14.7
ruff==0.14.13
six==1.17.0
# via python-dateutil
sniffio==1.3.1
# via imagekitio
standardwebhooks==1.0.0
standardwebhooks==1.0.1
# via imagekitio
time-machine==2.19.0
tomli==2.3.0
tomli==2.4.0
# via dependency-groups
# via mypy
# via nox
Expand All @@ -152,7 +152,7 @@ typing-extensions==4.15.0
# via virtualenv
typing-inspection==0.4.2
# via pydantic
virtualenv==20.35.4
virtualenv==20.36.1
# via nox
wrapt==2.0.1
# via deprecated
Expand Down
10 changes: 5 additions & 5 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.13.2
aiohttp==3.13.3
# via httpx-aiohttp
# via imagekitio
aiosignal==1.4.0
# via aiohttp
annotated-types==0.7.0
# via pydantic
anyio==4.12.0
anyio==4.12.1
# via httpx
# via imagekitio
async-timeout==5.0.1
# via aiohttp
attrs==25.4.0
# via aiohttp
# via standardwebhooks
certifi==2025.11.12
certifi==2026.1.4
# via httpcore
# via httpx
deprecated==1.3.1
Expand All @@ -47,7 +47,7 @@ httpx==0.28.1
# via httpx-aiohttp
# via imagekitio
# via standardwebhooks
httpx-aiohttp==0.1.9
httpx-aiohttp==0.1.12
# via imagekitio
idna==3.11
# via anyio
Expand All @@ -69,7 +69,7 @@ six==1.17.0
# via python-dateutil
sniffio==1.3.1
# via imagekitio
standardwebhooks==1.0.0
standardwebhooks==1.0.1
# via imagekitio
types-deprecated==1.3.1.20251101
# via standardwebhooks
Expand Down
41 changes: 0 additions & 41 deletions scripts/mock

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,7 @@ set -e

cd "$(dirname "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
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=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

export DEFER_PYDANTIC_BUILD=false

Expand Down
3 changes: 3 additions & 0 deletions src/imagekitio/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=extract_stream_chunk_type(self._stream_cls),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=cast_to,
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand Down
11 changes: 8 additions & 3 deletions src/imagekitio/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import inspect
from types import TracebackType
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable

import httpx
Expand All @@ -13,6 +13,7 @@

if TYPE_CHECKING:
from ._client import ImageKit, AsyncImageKit
from ._models import FinalRequestOptions


_T = TypeVar("_T")
Expand All @@ -22,7 +23,7 @@ class Stream(Generic[_T]):
"""Provides the core interface to iterate over a synchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEBytesDecoder

def __init__(
Expand All @@ -31,10 +32,12 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: ImageKit,
options: Optional[FinalRequestOptions] = None,
) -> None:
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()

Expand Down Expand Up @@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]):
"""Provides the core interface to iterate over an asynchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEDecoder | SSEBytesDecoder

def __init__(
Expand All @@ -94,10 +97,12 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: AsyncImageKit,
options: Optional[FinalRequestOptions] = None,
) -> None:
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()

Expand Down
2 changes: 1 addition & 1 deletion src/imagekitio/_utils/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool:
else:
import types

return tp is Union or tp is types.UnionType
return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap]


def is_typeddict(tp: Type[Any]) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion src/imagekitio/_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__ = "imagekitio"
__version__ = "5.2.0" # x-release-please-version
__version__ = "5.2.1" # x-release-please-version
Loading
Loading