diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4a2f7e6..4130df0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.1" + ".": "1.5.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 43a091d..2e862ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 1.5.2 (2026-02-25) + +Full Changelog: [v1.5.1...v1.5.2](https://github.com/Not-Diamond/not-diamond-python/compare/v1.5.1...v1.5.2) + +### Chores + +* **internal:** add request options to SSE classes ([0318c8c](https://github.com/Not-Diamond/not-diamond-python/commit/0318c8cbe29b70892c2838ce0399c4712058e077)) +* **internal:** make `test_proxy_environment_variables` more resilient ([bf042c7](https://github.com/Not-Diamond/not-diamond-python/commit/bf042c78c266ad77f3e037f9971dfdec55e691f3)) +* **internal:** make `test_proxy_environment_variables` more resilient to env ([02c3a32](https://github.com/Not-Diamond/not-diamond-python/commit/02c3a32aa289e14786a0a766a75724eced87f822)) +* update mock server docs ([ce8f436](https://github.com/Not-Diamond/not-diamond-python/commit/ce8f436984c0e46ed4d53c276add66e0603e3de0)) + ## 1.5.1 (2026-02-13) Full Changelog: [v1.5.0...v1.5.1](https://github.com/Not-Diamond/not-diamond-python/compare/v1.5.0...v1.5.1) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab48df8..95bb9b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,8 +88,7 @@ $ pip install ./path-to-wheel-file.whl 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 +$ ./scripts/mock ``` ```sh diff --git a/pyproject.toml b/pyproject.toml index d0facfd..d4be3b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "notdiamond" -version = "1.5.1" +version = "1.5.2" description = "The official Python library for the notdiamond API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/notdiamond/_response.py b/src/notdiamond/_response.py index a0eb4da..08f9208 100644 --- a/src/notdiamond/_response.py +++ b/src/notdiamond/_response.py @@ -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, ), ) @@ -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, ), ) @@ -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, ), ) diff --git a/src/notdiamond/_streaming.py b/src/notdiamond/_streaming.py index 65812af..4f95ab2 100644 --- a/src/notdiamond/_streaming.py +++ b/src/notdiamond/_streaming.py @@ -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 @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import NotDiamond, AsyncNotDiamond + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -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__( @@ -31,10 +32,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: NotDiamond, + 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__() @@ -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__( @@ -94,10 +97,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncNotDiamond, + 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__() diff --git a/src/notdiamond/_version.py b/src/notdiamond/_version.py index 7c95ddc..5e96d6c 100644 --- a/src/notdiamond/_version.py +++ b/src/notdiamond/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "notdiamond" -__version__ = "1.5.1" # x-release-please-version +__version__ = "1.5.2" # x-release-please-version diff --git a/tests/test_client.py b/tests/test_client.py index e2fd472..2363532 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1082,6 +1082,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultHttpxClient() @@ -2117,6 +2125,14 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultAsyncHttpxClient()