From c87d8aede4de4ba2865222011cd7b28202d0d2d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Feb 2026 00:08:48 +0000 Subject: [PATCH 01/26] chore: update SDK settings --- bin/publish-pypi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/publish-pypi b/bin/publish-pypi index a5d21d1..5895700 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,4 +4,8 @@ set -eux rm -rf dist mkdir -p dist uv build -uv publish +if [ -n "${PYPI_TOKEN:-}" ]; then + uv publish --token=$PYPI_TOKEN +else + uv publish +fi From 7c6f5e0d4eede9a88ec92a25071922644f473433 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Feb 2026 00:11:29 +0000 Subject: [PATCH 02/26] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 6 ++---- .github/workflows/release-doctor.yml | 2 ++ .stats.yml | 2 +- bin/check-release-environment | 4 ++++ bin/publish-pypi | 6 +----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 53f920f..1be9543 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,10 +12,6 @@ jobs: publish: name: publish runs-on: ubuntu-latest - permissions: - - id-token: write - contents: read steps: - uses: actions/checkout@v6 @@ -28,3 +24,5 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 5be741d..7f49e8e 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -17,3 +17,5 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 7d71630..e4e127d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nanonets%2Fdocstrange-a418fe45369669cc2d14b549ee010f3a7ee52f6e47fea3489e560d33064be099.yml openapi_spec_hash: 02f7f52faae1eb42188c290c32c25f10 -config_hash: 61ade82f6ddf75edd008789d19f04a3a +config_hash: b1979c16c99baf59cbbf8c7944a47297 diff --git a/bin/check-release-environment b/bin/check-release-environment index 1e951e9..b845b0f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${PYPI_TOKEN}" ]; then + 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[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index 5895700..e72ca2f 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,8 +4,4 @@ set -eux rm -rf dist mkdir -p dist uv build -if [ -n "${PYPI_TOKEN:-}" ]; then - uv publish --token=$PYPI_TOKEN -else - uv publish -fi +uv publish --token=$PYPI_TOKEN From 1dafac38b9d0a26e55a15e6ca90954ae3ac186e1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:26:49 +0000 Subject: [PATCH 03/26] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 5 +++-- .github/workflows/release-doctor.yml | 2 -- .stats.yml | 2 +- bin/check-release-environment | 4 ---- bin/publish-pypi | 6 +++++- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 1be9543..e1fd4b7 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,6 +12,9 @@ jobs: publish: name: publish runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -24,5 +27,3 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 7f49e8e..5be741d 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -17,5 +17,3 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index e4e127d..7d71630 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nanonets%2Fdocstrange-a418fe45369669cc2d14b549ee010f3a7ee52f6e47fea3489e560d33064be099.yml openapi_spec_hash: 02f7f52faae1eb42188c290c32c25f10 -config_hash: b1979c16c99baf59cbbf8c7944a47297 +config_hash: 61ade82f6ddf75edd008789d19f04a3a diff --git a/bin/check-release-environment b/bin/check-release-environment index b845b0f..1e951e9 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${PYPI_TOKEN}" ]; then - 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[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index e72ca2f..5895700 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,4 +4,8 @@ set -eux rm -rf dist mkdir -p dist uv build -uv publish --token=$PYPI_TOKEN +if [ -n "${PYPI_TOKEN:-}" ]; then + uv publish --token=$PYPI_TOKEN +else + uv publish +fi From bccc6c4c4c5784dfd388395ff5e429ed8348ddf3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 01:27:03 +0000 Subject: [PATCH 04/26] chore(internal): version bump --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 8e4d6e0..ee42b7c 100644 --- a/uv.lock +++ b/uv.lock @@ -262,7 +262,7 @@ wheels = [ [[package]] name = "docstrange-api" -version = "0.0.1" +version = "0.1.1" source = { editable = "." } dependencies = [ { name = "anyio" }, From 181d23f1cb3ba49a4f9e1b15904b6f554d45c47e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 07:25:32 +0000 Subject: [PATCH 05/26] chore: format all `api.md` files --- scripts/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/format b/scripts/format index 1d2f9c6..c8e1f69 100755 --- a/scripts/format +++ b/scripts/format @@ -11,4 +11,4 @@ uv run ruff check --fix . uv run ruff format echo "==> Formatting docs" -uv run python scripts/utils/ruffen-docs.py README.md api.md +uv run python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md) From 7ca1623eaa59ff51c76aa66a948052487416f767 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:44:16 +0000 Subject: [PATCH 06/26] chore(internal): remove mock server code --- scripts/mock | 41 ----------------------------------------- scripts/test | 46 ---------------------------------------------- 2 files changed, 87 deletions(-) delete mode 100755 scripts/mock diff --git a/scripts/mock b/scripts/mock deleted file mode 100755 index 0b28f6e..0000000 --- a/scripts/mock +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "$0")/.." - -if [[ -n "$1" && "$1" != '--'* ]]; then - URL="$1" - shift -else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 -fi - -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.15.0 -- prism mock "$URL" &> .prism.log & - - # Wait for server to come online - echo -n "Waiting for server" - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do - echo -n "." - sleep 0.1 - done - - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - - echo -else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" -fi diff --git a/scripts/test b/scripts/test index b56970b..fe50ebb 100755 --- a/scripts/test +++ b/scripts/test @@ -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 From 4b3083c18f27cede567c9ee00186c4c69723dc92 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:44:55 +0000 Subject: [PATCH 07/26] chore: update mock server docs --- CONTRIBUTING.md | 7 --- tests/api_resources/extract/test_results.py | 36 ++++++------ tests/api_resources/test_chat.py | 16 +++--- tests/api_resources/test_classify.py | 24 ++++---- tests/api_resources/test_extract.py | 64 ++++++++++----------- 5 files changed, 70 insertions(+), 77 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62e046f..eb13d09 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 ``` diff --git a/tests/api_resources/extract/test_results.py b/tests/api_resources/extract/test_results.py index ee1d5f5..c1621d4 100644 --- a/tests/api_resources/extract/test_results.py +++ b/tests/api_resources/extract/test_results.py @@ -18,7 +18,7 @@ class TestResults: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Docstrange) -> None: result = client.extract.results.retrieve( @@ -26,7 +26,7 @@ def test_method_retrieve(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve_with_all_params(self, client: Docstrange) -> None: result = client.extract.results.retrieve( @@ -35,7 +35,7 @@ def test_method_retrieve_with_all_params(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Docstrange) -> None: response = client.extract.results.with_raw_response.retrieve( @@ -47,7 +47,7 @@ def test_raw_response_retrieve(self, client: Docstrange) -> None: result = response.parse() assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Docstrange) -> None: with client.extract.results.with_streaming_response.retrieve( @@ -61,7 +61,7 @@ def test_streaming_response_retrieve(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Docstrange) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `record_id` but received ''"): @@ -69,13 +69,13 @@ def test_path_params_retrieve(self, client: Docstrange) -> None: record_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Docstrange) -> None: result = client.extract.results.list() assert_matches_type(SyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Docstrange) -> None: result = client.extract.results.list( @@ -86,7 +86,7 @@ def test_method_list_with_all_params(self, client: Docstrange) -> None: ) assert_matches_type(SyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Docstrange) -> None: response = client.extract.results.with_raw_response.list() @@ -96,7 +96,7 @@ def test_raw_response_list(self, client: Docstrange) -> None: result = response.parse() assert_matches_type(SyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Docstrange) -> None: with client.extract.results.with_streaming_response.list() as response: @@ -114,7 +114,7 @@ class TestAsyncResults: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncDocstrange) -> None: result = await async_client.extract.results.retrieve( @@ -122,7 +122,7 @@ async def test_method_retrieve(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncDocstrange) -> None: result = await async_client.extract.results.retrieve( @@ -131,7 +131,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncDocstran ) assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.results.with_raw_response.retrieve( @@ -143,7 +143,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncDocstrange) -> Non result = await response.parse() assert_matches_type(ExtractResponse, result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.results.with_streaming_response.retrieve( @@ -157,7 +157,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDocstrange) assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncDocstrange) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `record_id` but received ''"): @@ -165,13 +165,13 @@ async def test_path_params_retrieve(self, async_client: AsyncDocstrange) -> None record_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncDocstrange) -> None: result = await async_client.extract.results.list() assert_matches_type(AsyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDocstrange) -> None: result = await async_client.extract.results.list( @@ -182,7 +182,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncDocstrange) ) assert_matches_type(AsyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.results.with_raw_response.list() @@ -192,7 +192,7 @@ async def test_raw_response_list(self, async_client: AsyncDocstrange) -> None: result = await response.parse() assert_matches_type(AsyncPageNumberPagination[ExtractResponse], result, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.results.with_streaming_response.list() as response: diff --git a/tests/api_resources/test_chat.py b/tests/api_resources/test_chat.py index cbcd7c3..a07d435 100644 --- a/tests/api_resources/test_chat.py +++ b/tests/api_resources/test_chat.py @@ -16,7 +16,7 @@ class TestChat: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_completion(self, client: Docstrange) -> None: chat = client.chat.create_completion( @@ -30,7 +30,7 @@ def test_method_create_completion(self, client: Docstrange) -> None: ) assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_completion_with_all_params(self, client: Docstrange) -> None: chat = client.chat.create_completion( @@ -58,7 +58,7 @@ def test_method_create_completion_with_all_params(self, client: Docstrange) -> N ) assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create_completion(self, client: Docstrange) -> None: response = client.chat.with_raw_response.create_completion( @@ -76,7 +76,7 @@ def test_raw_response_create_completion(self, client: Docstrange) -> None: chat = response.parse() assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create_completion(self, client: Docstrange) -> None: with client.chat.with_streaming_response.create_completion( @@ -102,7 +102,7 @@ class TestAsyncChat: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_completion(self, async_client: AsyncDocstrange) -> None: chat = await async_client.chat.create_completion( @@ -116,7 +116,7 @@ async def test_method_create_completion(self, async_client: AsyncDocstrange) -> ) assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_completion_with_all_params(self, async_client: AsyncDocstrange) -> None: chat = await async_client.chat.create_completion( @@ -144,7 +144,7 @@ async def test_method_create_completion_with_all_params(self, async_client: Asyn ) assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create_completion(self, async_client: AsyncDocstrange) -> None: response = await async_client.chat.with_raw_response.create_completion( @@ -162,7 +162,7 @@ async def test_raw_response_create_completion(self, async_client: AsyncDocstrang chat = await response.parse() assert_matches_type(object, chat, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create_completion(self, async_client: AsyncDocstrange) -> None: async with async_client.chat.with_streaming_response.create_completion( diff --git a/tests/api_resources/test_classify.py b/tests/api_resources/test_classify.py index b4377f6..3cd16d1 100644 --- a/tests/api_resources/test_classify.py +++ b/tests/api_resources/test_classify.py @@ -17,7 +17,7 @@ class TestClassify: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_batch(self, client: Docstrange) -> None: classify = client.classify.batch( @@ -26,7 +26,7 @@ def test_method_batch(self, client: Docstrange) -> None: ) assert_matches_type(BatchClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_batch(self, client: Docstrange) -> None: response = client.classify.with_raw_response.batch( @@ -39,7 +39,7 @@ def test_raw_response_batch(self, client: Docstrange) -> None: classify = response.parse() assert_matches_type(BatchClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_batch(self, client: Docstrange) -> None: with client.classify.with_streaming_response.batch( @@ -54,7 +54,7 @@ def test_streaming_response_batch(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_sync(self, client: Docstrange) -> None: classify = client.classify.sync( @@ -63,7 +63,7 @@ def test_method_sync(self, client: Docstrange) -> None: ) assert_matches_type(ClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_sync(self, client: Docstrange) -> None: response = client.classify.with_raw_response.sync( @@ -76,7 +76,7 @@ def test_raw_response_sync(self, client: Docstrange) -> None: classify = response.parse() assert_matches_type(ClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_sync(self, client: Docstrange) -> None: with client.classify.with_streaming_response.sync( @@ -97,7 +97,7 @@ class TestAsyncClassify: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_batch(self, async_client: AsyncDocstrange) -> None: classify = await async_client.classify.batch( @@ -106,7 +106,7 @@ async def test_method_batch(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(BatchClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: response = await async_client.classify.with_raw_response.batch( @@ -119,7 +119,7 @@ async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: classify = await response.parse() assert_matches_type(BatchClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> None: async with async_client.classify.with_streaming_response.batch( @@ -134,7 +134,7 @@ async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_sync(self, async_client: AsyncDocstrange) -> None: classify = await async_client.classify.sync( @@ -143,7 +143,7 @@ async def test_method_sync(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(ClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: response = await async_client.classify.with_raw_response.sync( @@ -156,7 +156,7 @@ async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: classify = await response.parse() assert_matches_type(ClassifyResponse, classify, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_sync(self, async_client: AsyncDocstrange) -> None: async with async_client.classify.with_streaming_response.sync( diff --git a/tests/api_resources/test_extract.py b/tests/api_resources/test_extract.py index ffdac33..32f6a45 100644 --- a/tests/api_resources/test_extract.py +++ b/tests/api_resources/test_extract.py @@ -20,7 +20,7 @@ class TestExtract: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_async(self, client: Docstrange) -> None: extract = client.extract.async_( @@ -28,7 +28,7 @@ def test_method_async(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_async_with_all_params(self, client: Docstrange) -> None: extract = client.extract.async_( @@ -44,7 +44,7 @@ def test_method_async_with_all_params(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_async(self, client: Docstrange) -> None: response = client.extract.with_raw_response.async_( @@ -56,7 +56,7 @@ def test_raw_response_async(self, client: Docstrange) -> None: extract = response.parse() assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_async(self, client: Docstrange) -> None: with client.extract.with_streaming_response.async_( @@ -70,7 +70,7 @@ def test_streaming_response_async(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_batch(self, client: Docstrange) -> None: extract = client.extract.batch( @@ -79,7 +79,7 @@ def test_method_batch(self, client: Docstrange) -> None: ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_batch_with_all_params(self, client: Docstrange) -> None: extract = client.extract.batch( @@ -93,7 +93,7 @@ def test_method_batch_with_all_params(self, client: Docstrange) -> None: ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_batch(self, client: Docstrange) -> None: response = client.extract.with_raw_response.batch( @@ -106,7 +106,7 @@ def test_raw_response_batch(self, client: Docstrange) -> None: extract = response.parse() assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_batch(self, client: Docstrange) -> None: with client.extract.with_streaming_response.batch( @@ -121,7 +121,7 @@ def test_streaming_response_batch(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize def test_method_stream(self, client: Docstrange) -> None: extract_stream = client.extract.stream( @@ -129,7 +129,7 @@ def test_method_stream(self, client: Docstrange) -> None: ) extract_stream.response.close() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize def test_method_stream_with_all_params(self, client: Docstrange) -> None: extract_stream = client.extract.stream( @@ -146,7 +146,7 @@ def test_method_stream_with_all_params(self, client: Docstrange) -> None: ) extract_stream.response.close() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize def test_raw_response_stream(self, client: Docstrange) -> None: response = client.extract.with_raw_response.stream( @@ -157,7 +157,7 @@ def test_raw_response_stream(self, client: Docstrange) -> None: stream = response.parse() stream.close() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize def test_streaming_response_stream(self, client: Docstrange) -> None: with client.extract.with_streaming_response.stream( @@ -171,7 +171,7 @@ def test_streaming_response_stream(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_sync(self, client: Docstrange) -> None: extract = client.extract.sync( @@ -179,7 +179,7 @@ def test_method_sync(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_sync_with_all_params(self, client: Docstrange) -> None: extract = client.extract.sync( @@ -195,7 +195,7 @@ def test_method_sync_with_all_params(self, client: Docstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_sync(self, client: Docstrange) -> None: response = client.extract.with_raw_response.sync( @@ -207,7 +207,7 @@ def test_raw_response_sync(self, client: Docstrange) -> None: extract = response.parse() assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_sync(self, client: Docstrange) -> None: with client.extract.with_streaming_response.sync( @@ -227,7 +227,7 @@ class TestAsyncExtract: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_async(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.async_( @@ -235,7 +235,7 @@ async def test_method_async(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_async_with_all_params(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.async_( @@ -251,7 +251,7 @@ async def test_method_async_with_all_params(self, async_client: AsyncDocstrange) ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_async(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.async_( @@ -263,7 +263,7 @@ async def test_raw_response_async(self, async_client: AsyncDocstrange) -> None: extract = await response.parse() assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_async(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.async_( @@ -277,7 +277,7 @@ async def test_streaming_response_async(self, async_client: AsyncDocstrange) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_batch(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.batch( @@ -286,7 +286,7 @@ async def test_method_batch(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_batch_with_all_params(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.batch( @@ -300,7 +300,7 @@ async def test_method_batch_with_all_params(self, async_client: AsyncDocstrange) ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.batch( @@ -313,7 +313,7 @@ async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: extract = await response.parse() assert_matches_type(BatchExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.batch( @@ -328,7 +328,7 @@ async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize async def test_method_stream(self, async_client: AsyncDocstrange) -> None: extract_stream = await async_client.extract.stream( @@ -336,7 +336,7 @@ async def test_method_stream(self, async_client: AsyncDocstrange) -> None: ) await extract_stream.response.aclose() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize async def test_method_stream_with_all_params(self, async_client: AsyncDocstrange) -> None: extract_stream = await async_client.extract.stream( @@ -353,7 +353,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncDocstrange ) await extract_stream.response.aclose() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize async def test_raw_response_stream(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.stream( @@ -364,7 +364,7 @@ async def test_raw_response_stream(self, async_client: AsyncDocstrange) -> None: stream = await response.parse() await stream.close() - @pytest.mark.skip(reason="Prism doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") @parametrize async def test_streaming_response_stream(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.stream( @@ -378,7 +378,7 @@ async def test_streaming_response_stream(self, async_client: AsyncDocstrange) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_sync(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.sync( @@ -386,7 +386,7 @@ async def test_method_sync(self, async_client: AsyncDocstrange) -> None: ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_sync_with_all_params(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.sync( @@ -402,7 +402,7 @@ async def test_method_sync_with_all_params(self, async_client: AsyncDocstrange) ) assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.sync( @@ -414,7 +414,7 @@ async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: extract = await response.parse() assert_matches_type(ExtractResponse, extract, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_sync(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.sync( From abd2c81bcd43080e8bf606af12e8d4b9889e62a1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:46:14 +0000 Subject: [PATCH 08/26] chore(test): update skip reason message --- tests/api_resources/test_extract.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/api_resources/test_extract.py b/tests/api_resources/test_extract.py index 32f6a45..f2b8c24 100644 --- a/tests/api_resources/test_extract.py +++ b/tests/api_resources/test_extract.py @@ -121,7 +121,7 @@ def test_streaming_response_batch(self, client: Docstrange) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_stream(self, client: Docstrange) -> None: extract_stream = client.extract.stream( @@ -129,7 +129,7 @@ def test_method_stream(self, client: Docstrange) -> None: ) extract_stream.response.close() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_stream_with_all_params(self, client: Docstrange) -> None: extract_stream = client.extract.stream( @@ -146,7 +146,7 @@ def test_method_stream_with_all_params(self, client: Docstrange) -> None: ) extract_stream.response.close() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_stream(self, client: Docstrange) -> None: response = client.extract.with_raw_response.stream( @@ -157,7 +157,7 @@ def test_raw_response_stream(self, client: Docstrange) -> None: stream = response.parse() stream.close() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_stream(self, client: Docstrange) -> None: with client.extract.with_streaming_response.stream( @@ -328,7 +328,7 @@ async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_stream(self, async_client: AsyncDocstrange) -> None: extract_stream = await async_client.extract.stream( @@ -336,7 +336,7 @@ async def test_method_stream(self, async_client: AsyncDocstrange) -> None: ) await extract_stream.response.aclose() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_stream_with_all_params(self, async_client: AsyncDocstrange) -> None: extract_stream = await async_client.extract.stream( @@ -353,7 +353,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncDocstrange ) await extract_stream.response.aclose() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_stream(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.stream( @@ -364,7 +364,7 @@ async def test_raw_response_stream(self, async_client: AsyncDocstrange) -> None: stream = await response.parse() await stream.close() - @pytest.mark.skip(reason="Mock server doesn't support text/event-stream responses") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_stream(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.stream( From db43c2d91944f4dbfa4c10a29ae9710d72ac354d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:51:56 +0000 Subject: [PATCH 09/26] chore(internal): add request options to SSE classes --- src/docstrange/_response.py | 3 +++ src/docstrange/_streaming.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/docstrange/_response.py b/src/docstrange/_response.py index adb9a91..f9c2a7c 100644 --- a/src/docstrange/_response.py +++ b/src/docstrange/_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/docstrange/_streaming.py b/src/docstrange/_streaming.py index e7621fd..7b95d7c 100644 --- a/src/docstrange/_streaming.py +++ b/src/docstrange/_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 Docstrange, AsyncDocstrange + 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: Docstrange, + 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: AsyncDocstrange, + 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__() From 813e69df0940d2528b14f076b9583d90edffd2a2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:59:47 +0000 Subject: [PATCH 10/26] chore(internal): make `test_proxy_environment_variables` more resilient --- tests/test_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 3d576f6..65c81d5 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -959,6 +959,8 @@ 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 this set + monkeypatch.delenv("HTTP_PROXY", raising=False) client = DefaultHttpxClient() @@ -1871,6 +1873,8 @@ 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 this set + monkeypatch.delenv("HTTP_PROXY", raising=False) client = DefaultAsyncHttpxClient() From 135f28ba8d42802aeaf25a2a0e4b04189390c0b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:06:10 +0000 Subject: [PATCH 11/26] chore(internal): make `test_proxy_environment_variables` more resilient to env --- tests/test_client.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 65c81d5..187b34a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -959,8 +959,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 this set + # 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() @@ -1873,8 +1879,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 this set + # 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() From c323a36839f55b7a9d64749b57c109cdfac3242d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:37:02 +0000 Subject: [PATCH 12/26] chore(ci): bump uv version --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e18483a..a75183e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 with: - version: '0.9.13' + version: '0.10.2' - name: Install dependencies run: uv sync --all-extras @@ -46,7 +46,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 with: - version: '0.9.13' + version: '0.10.2' - name: Install dependencies run: uv sync --all-extras @@ -80,7 +80,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 with: - version: '0.9.13' + version: '0.10.2' - name: Bootstrap run: ./scripts/bootstrap From d91fcfa6b17d19771a43c30af59d1eff3b484931 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 08:29:54 +0000 Subject: [PATCH 13/26] chore(internal): refactor authentication internals --- src/docstrange/_base_client.py | 34 ++++++++++++++++++++++++++++------ src/docstrange/_client.py | 19 +++++++++++++++---- src/docstrange/_models.py | 6 ++++++ src/docstrange/_types.py | 3 ++- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/docstrange/_base_client.py b/src/docstrange/_base_client.py index c341e4f..b4f3c3f 100644 --- a/src/docstrange/_base_client.py +++ b/src/docstrange/_base_client.py @@ -63,7 +63,7 @@ ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump -from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type +from ._models import GenericModel, SecurityOptions, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, BaseAPIResponse, @@ -432,9 +432,27 @@ def _make_status_error( ) -> _exceptions.APIStatusError: raise NotImplementedError() + def _auth_headers( + self, + security: SecurityOptions, # noqa: ARG002 + ) -> dict[str, str]: + return {} + + def _auth_query( + self, + security: SecurityOptions, # noqa: ARG002 + ) -> dict[str, str]: + return {} + + def _custom_auth( + self, + security: SecurityOptions, # noqa: ARG002 + ) -> httpx.Auth | None: + return None + def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers: custom_headers = options.headers or {} - headers_dict = _merge_mappings(self.default_headers, custom_headers) + headers_dict = _merge_mappings({**self._auth_headers(options.security), **self.default_headers}, custom_headers) self._validate_headers(headers_dict, custom_headers) # headers are case-insensitive while dictionaries are not. @@ -506,7 +524,7 @@ def _build_request( raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") headers = self._build_headers(options, retries_taken=retries_taken) - params = _merge_mappings(self.default_query, options.params) + params = _merge_mappings({**self._auth_query(options.security), **self.default_query}, options.params) content_type = headers.get("Content-Type") files = options.files @@ -671,7 +689,6 @@ def default_headers(self) -> dict[str, str | Omit]: "Content-Type": "application/json", "User-Agent": self.user_agent, **self.platform_headers(), - **self.auth_headers, **self._custom_headers, } @@ -990,8 +1007,9 @@ def request( self._prepare_request(request) kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + custom_auth = self._custom_auth(options.security) + if custom_auth is not None: + kwargs["auth"] = custom_auth if options.follow_redirects is not None: kwargs["follow_redirects"] = options.follow_redirects @@ -1952,6 +1970,7 @@ def make_request_options( idempotency_key: str | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, post_parser: PostParser | NotGiven = not_given, + security: SecurityOptions | None = None, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} @@ -1977,6 +1996,9 @@ def make_request_options( # internal options["post_parser"] = post_parser # type: ignore + if security is not None: + options["security"] = security + return options diff --git a/src/docstrange/_client.py b/src/docstrange/_client.py index 4c5bcc4..cf52039 100644 --- a/src/docstrange/_client.py +++ b/src/docstrange/_client.py @@ -21,6 +21,7 @@ ) from ._utils import is_given, get_async_library from ._compat import cached_property +from ._models import SecurityOptions from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError, DocstrangeError @@ -134,9 +135,14 @@ def with_streaming_response(self) -> DocstrangeWithStreamedResponse: def qs(self) -> Querystring: return Querystring(array_format="comma") - @property @override - def auth_headers(self) -> dict[str, str]: + def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: + return { + **(self._bearer_auth if security.get("bearer_auth", False) else {}), + } + + @property + def _bearer_auth(self) -> dict[str, str]: api_key = self.api_key return {"Authorization": f"Bearer {api_key}"} @@ -320,9 +326,14 @@ def with_streaming_response(self) -> AsyncDocstrangeWithStreamedResponse: def qs(self) -> Querystring: return Querystring(array_format="comma") - @property @override - def auth_headers(self) -> dict[str, str]: + def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: + return { + **(self._bearer_auth if security.get("bearer_auth", False) else {}), + } + + @property + def _bearer_auth(self) -> dict[str, str]: api_key = self.api_key return {"Authorization": f"Bearer {api_key}"} diff --git a/src/docstrange/_models.py b/src/docstrange/_models.py index 29070e0..e22dd2a 100644 --- a/src/docstrange/_models.py +++ b/src/docstrange/_models.py @@ -791,6 +791,10 @@ def _create_pydantic_model(type_: _T) -> Type[RootModel[_T]]: return RootModel[type_] # type: ignore +class SecurityOptions(TypedDict, total=False): + bearer_auth: bool + + class FinalRequestOptionsInput(TypedDict, total=False): method: Required[str] url: Required[str] @@ -804,6 +808,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): json_data: Body extra_json: AnyMapping follow_redirects: bool + security: SecurityOptions @final @@ -818,6 +823,7 @@ class FinalRequestOptions(pydantic.BaseModel): idempotency_key: Union[str, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() follow_redirects: Union[bool, None] = None + security: SecurityOptions = {"bearer_auth": True} content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override diff --git a/src/docstrange/_types.py b/src/docstrange/_types.py index 60ecac9..8364a0e 100644 --- a/src/docstrange/_types.py +++ b/src/docstrange/_types.py @@ -36,7 +36,7 @@ from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport if TYPE_CHECKING: - from ._models import BaseModel + from ._models import BaseModel, SecurityOptions from ._response import APIResponse, AsyncAPIResponse Transport = BaseTransport @@ -121,6 +121,7 @@ class RequestOptions(TypedDict, total=False): extra_json: AnyMapping idempotency_key: str follow_redirects: bool + security: SecurityOptions # Sentinel class used until PEP 0661 is accepted From c4ae12c45ae60c005b25136b1fe1a1357966b7cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 00:57:44 +0000 Subject: [PATCH 14/26] chore(ci): skip uploading artifacts on stainless-internal branches --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a75183e..d55f9fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,14 +55,18 @@ jobs: run: uv build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/docstrange-python' + if: |- + github.repository == 'stainless-sdks/docstrange-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/docstrange-python' + if: |- + github.repository == 'stainless-sdks/docstrange-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From c15515aa7218d4d07c85543c0438539e339c5d44 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 00:59:11 +0000 Subject: [PATCH 15/26] chore: update placeholder string --- tests/api_resources/test_classify.py | 24 ++++++++++++------------ tests/api_resources/test_extract.py | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/api_resources/test_classify.py b/tests/api_resources/test_classify.py index 3cd16d1..d56a4f5 100644 --- a/tests/api_resources/test_classify.py +++ b/tests/api_resources/test_classify.py @@ -22,7 +22,7 @@ class TestClassify: def test_method_batch(self, client: Docstrange) -> None: classify = client.classify.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) assert_matches_type(BatchClassifyResponse, classify, path=["response"]) @@ -31,7 +31,7 @@ def test_method_batch(self, client: Docstrange) -> None: def test_raw_response_batch(self, client: Docstrange) -> None: response = client.classify.with_raw_response.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) assert response.is_closed is True @@ -44,7 +44,7 @@ def test_raw_response_batch(self, client: Docstrange) -> None: def test_streaming_response_batch(self, client: Docstrange) -> None: with client.classify.with_streaming_response.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -59,7 +59,7 @@ def test_streaming_response_batch(self, client: Docstrange) -> None: def test_method_sync(self, client: Docstrange) -> None: classify = client.classify.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) assert_matches_type(ClassifyResponse, classify, path=["response"]) @@ -68,7 +68,7 @@ def test_method_sync(self, client: Docstrange) -> None: def test_raw_response_sync(self, client: Docstrange) -> None: response = client.classify.with_raw_response.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) assert response.is_closed is True @@ -81,7 +81,7 @@ def test_raw_response_sync(self, client: Docstrange) -> None: def test_streaming_response_sync(self, client: Docstrange) -> None: with client.classify.with_streaming_response.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -102,7 +102,7 @@ class TestAsyncClassify: async def test_method_batch(self, async_client: AsyncDocstrange) -> None: classify = await async_client.classify.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) assert_matches_type(BatchClassifyResponse, classify, path=["response"]) @@ -111,7 +111,7 @@ async def test_method_batch(self, async_client: AsyncDocstrange) -> None: async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: response = await async_client.classify.with_raw_response.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) assert response.is_closed is True @@ -124,7 +124,7 @@ async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> None: async with async_client.classify.with_streaming_response.batch( categories='[{"name": "Invoice"}, {"name": "Contract"}, {"name": "Receipt"}]', - files=[b"raw file contents"], + files=[b"Example data"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,7 +139,7 @@ async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> async def test_method_sync(self, async_client: AsyncDocstrange) -> None: classify = await async_client.classify.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) assert_matches_type(ClassifyResponse, classify, path=["response"]) @@ -148,7 +148,7 @@ async def test_method_sync(self, async_client: AsyncDocstrange) -> None: async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: response = await async_client.classify.with_raw_response.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) assert response.is_closed is True @@ -161,7 +161,7 @@ async def test_raw_response_sync(self, async_client: AsyncDocstrange) -> None: async def test_streaming_response_sync(self, async_client: AsyncDocstrange) -> None: async with async_client.classify.with_streaming_response.sync( categories='[{"name": "Invoice", "description": "Bills and invoices"}, {"name": "Contract", "description": "Legal agreements"}]', - file=b"raw file contents", + file=b"Example data", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_extract.py b/tests/api_resources/test_extract.py index f2b8c24..4781f70 100644 --- a/tests/api_resources/test_extract.py +++ b/tests/api_resources/test_extract.py @@ -35,7 +35,7 @@ def test_method_async_with_all_params(self, client: Docstrange) -> None: output_format="markdown", csv_options="", custom_instructions="", - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", @@ -74,7 +74,7 @@ def test_streaming_response_async(self, client: Docstrange) -> None: @parametrize def test_method_batch(self, client: Docstrange) -> None: extract = client.extract.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) @@ -83,7 +83,7 @@ def test_method_batch(self, client: Docstrange) -> None: @parametrize def test_method_batch_with_all_params(self, client: Docstrange) -> None: extract = client.extract.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", csv_options="csv_options", custom_instructions="custom_instructions", @@ -97,7 +97,7 @@ def test_method_batch_with_all_params(self, client: Docstrange) -> None: @parametrize def test_raw_response_batch(self, client: Docstrange) -> None: response = client.extract.with_raw_response.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) @@ -110,7 +110,7 @@ def test_raw_response_batch(self, client: Docstrange) -> None: @parametrize def test_streaming_response_batch(self, client: Docstrange) -> None: with client.extract.with_streaming_response.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) as response: assert not response.is_closed @@ -137,7 +137,7 @@ def test_method_stream_with_all_params(self, client: Docstrange) -> None: csv_options="", custom_instructions="", enable_streaming=True, - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", @@ -186,7 +186,7 @@ def test_method_sync_with_all_params(self, client: Docstrange) -> None: output_format="markdown", csv_options="", custom_instructions="", - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", @@ -242,7 +242,7 @@ async def test_method_async_with_all_params(self, async_client: AsyncDocstrange) output_format="markdown", csv_options="", custom_instructions="", - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", @@ -281,7 +281,7 @@ async def test_streaming_response_async(self, async_client: AsyncDocstrange) -> @parametrize async def test_method_batch(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) assert_matches_type(BatchExtractResponse, extract, path=["response"]) @@ -290,7 +290,7 @@ async def test_method_batch(self, async_client: AsyncDocstrange) -> None: @parametrize async def test_method_batch_with_all_params(self, async_client: AsyncDocstrange) -> None: extract = await async_client.extract.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", csv_options="csv_options", custom_instructions="custom_instructions", @@ -304,7 +304,7 @@ async def test_method_batch_with_all_params(self, async_client: AsyncDocstrange) @parametrize async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: response = await async_client.extract.with_raw_response.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) @@ -317,7 +317,7 @@ async def test_raw_response_batch(self, async_client: AsyncDocstrange) -> None: @parametrize async def test_streaming_response_batch(self, async_client: AsyncDocstrange) -> None: async with async_client.extract.with_streaming_response.batch( - files=[b"raw file contents"], + files=[b"Example data"], output_format="markdown", ) as response: assert not response.is_closed @@ -344,7 +344,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncDocstrange csv_options="", custom_instructions="", enable_streaming=True, - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", @@ -393,7 +393,7 @@ async def test_method_sync_with_all_params(self, async_client: AsyncDocstrange) output_format="markdown", csv_options="", custom_instructions="", - file=b"raw file contents", + file=b"Example data", file_base64="", file_url="", include_metadata="", From 8281a9a9ca7f2b2e97a11eccbb27c26445f8b741 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:44:41 +0000 Subject: [PATCH 16/26] fix(pydantic): do not pass `by_alias` unless set --- src/docstrange/_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/docstrange/_compat.py b/src/docstrange/_compat.py index 786ff42..e6690a4 100644 --- a/src/docstrange/_compat.py +++ b/src/docstrange/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", From 3293c8459d7cd5831d9497fe222d5b2479ceba6a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:49:29 +0000 Subject: [PATCH 17/26] fix(deps): bump minimum typing-extensions version --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 663fa4f..d213f7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", + "typing-extensions>=4.14, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", diff --git a/uv.lock b/uv.lock index ee42b7c..1330920 100644 --- a/uv.lock +++ b/uv.lock @@ -313,7 +313,7 @@ requires-dist = [ { name = "httpx-aiohttp", marker = "extra == 'aiohttp'", specifier = ">=0.1.9" }, { name = "pydantic", specifier = ">=1.9.0,<3" }, { name = "sniffio" }, - { name = "typing-extensions", specifier = ">=4.10,<5" }, + { name = "typing-extensions", specifier = ">=4.14,<5" }, ] provides-extras = ["aiohttp"] From cb69cd0526fbc4a37ea880f06729681921589a1f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:52:39 +0000 Subject: [PATCH 18/26] chore(internal): tweak CI branches --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d55f9fe..73fca34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' From 2529403cdb31e5f4591924947c9c9f281f3cf7de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:53:28 +0000 Subject: [PATCH 19/26] fix: sanitize endpoint path params --- src/docstrange/_utils/__init__.py | 1 + src/docstrange/_utils/_path.py | 127 ++++++++++++++++++++ src/docstrange/resources/extract/results.py | 6 +- tests/test_utils/test_path.py | 89 ++++++++++++++ 4 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 src/docstrange/_utils/_path.py create mode 100644 tests/test_utils/test_path.py diff --git a/src/docstrange/_utils/__init__.py b/src/docstrange/_utils/__init__.py index dc64e29..10cb66d 100644 --- a/src/docstrange/_utils/__init__.py +++ b/src/docstrange/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( diff --git a/src/docstrange/_utils/_path.py b/src/docstrange/_utils/_path.py new file mode 100644 index 0000000..4d6e1e4 --- /dev/null +++ b/src/docstrange/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/docstrange/resources/extract/results.py b/src/docstrange/resources/extract/results.py index 1533ac2..a45eb0b 100644 --- a/src/docstrange/resources/extract/results.py +++ b/src/docstrange/resources/extract/results.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -73,7 +73,7 @@ def retrieve( if not record_id: raise ValueError(f"Expected a non-empty value for `record_id` but received {record_id!r}") return self._get( - f"/api/v1/extract/results/{record_id}", + path_template("/api/v1/extract/results/{record_id}", record_id=record_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -184,7 +184,7 @@ async def retrieve( if not record_id: raise ValueError(f"Expected a non-empty value for `record_id` but received {record_id!r}") return await self._get( - f"/api/v1/extract/results/{record_id}", + path_template("/api/v1/extract/results/{record_id}", record_id=record_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 0000000..c13bafc --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from docstrange._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs) From d1375ede29d45d13aba9f38066e35f61433c0641 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 05:13:59 +0000 Subject: [PATCH 20/26] chore(internal): update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 95ceb18..3824f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log _dev __pycache__ From aa1f737af893ccd0ff6b86e39f3273fc4d01eff5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 03:30:51 +0000 Subject: [PATCH 21/26] chore(ci): skip lint on metadata-only changes Note that we still want to run tests, as these depend on the metadata. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73fca34..dcde091 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/docstrange-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -35,7 +35,7 @@ jobs: run: ./scripts/lint build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') timeout-minutes: 10 name: build permissions: From 279068029d8c1533c1058b6daf50415c96a7d793 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 06:48:16 +0000 Subject: [PATCH 22/26] feat(internal): implement indices array format for query and form serialization --- src/docstrange/_qs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/docstrange/_qs.py b/src/docstrange/_qs.py index ada6fd3..de8c99b 100644 --- a/src/docstrange/_qs.py +++ b/src/docstrange/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" From e0ff6ac6cfea51d7a15a2020241444bab09db5e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 05:19:06 +0000 Subject: [PATCH 23/26] fix(client): preserve hardcoded query params when merging with user params --- src/docstrange/_base_client.py | 4 +++ tests/test_client.py | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/docstrange/_base_client.py b/src/docstrange/_base_client.py index b4f3c3f..5b09d39 100644 --- a/src/docstrange/_base_client.py +++ b/src/docstrange/_base_client.py @@ -558,6 +558,10 @@ def _build_request( files = cast(HttpxRequestFiles, ForceMultipartDict()) prepared_url = self._prepare_url(options.url) + # preserve hard-coded query params from the url + if params and prepared_url.query: + params = {**dict(prepared_url.params.items()), **params} + prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0]) if "_" in prepared_url.host: # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} diff --git a/tests/test_client.py b/tests/test_client.py index 187b34a..a593d05 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -429,6 +429,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: Docstrange) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: Docstrange) -> None: request = client._build_request( FinalRequestOptions( @@ -1332,6 +1356,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncDocstrange) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: Docstrange) -> None: request = client._build_request( FinalRequestOptions( From 704c186421bdedbacdd109e359ed3005ba053f6e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:18:20 +0000 Subject: [PATCH 24/26] fix: ensure file data are only sent as 1 parameter --- src/docstrange/_utils/_utils.py | 5 +++-- tests/test_extract_files.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/docstrange/_utils/_utils.py b/src/docstrange/_utils/_utils.py index eec7f4a..63b8cd6 100644 --- a/src/docstrange/_utils/_utils.py +++ b/src/docstrange/_utils/_utils.py @@ -86,8 +86,9 @@ def _extract_items( index += 1 if is_dict(obj): try: - # We are at the last entry in the path so we must remove the field - if (len(path)) == index: + # Remove the field if there are no more dict keys in the path, + # only "" traversal markers or end. + if all(p == "" for p in path[index:]): item = obj.pop(key) else: item = obj[key] diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index 2db78b3..e9efec6 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -35,6 +35,15 @@ def test_multiple_files() -> None: assert query == {"documents": [{}, {}]} +def test_top_level_file_array() -> None: + query = {"files": [b"file one", b"file two"], "title": "hello"} + assert extract_files(query, paths=[["files", ""]]) == [ + ("files[]", b"file one"), + ("files[]", b"file two"), + ] + assert query == {"title": "hello"} + + @pytest.mark.parametrize( "query,paths,expected", [ From ddfbedf1d6de0be142fc73ad1874d001a723c32f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 08:24:57 +0000 Subject: [PATCH 25/26] chore(internal): codegen related update --- src/docstrange/_files.py | 56 +++++++++++- src/docstrange/_utils/__init__.py | 1 - src/docstrange/_utils/_utils.py | 15 ---- src/docstrange/resources/classify.py | 23 +++-- src/docstrange/resources/extract/extract.py | 43 +++++---- tests/test_deepcopy.py | 58 ------------ tests/test_files.py | 99 ++++++++++++++++++++- 7 files changed, 191 insertions(+), 104 deletions(-) delete mode 100644 tests/test_deepcopy.py diff --git a/src/docstrange/_files.py b/src/docstrange/_files.py index 4ea5ccb..b4048c6 100644 --- a/src/docstrange/_files.py +++ b/src/docstrange/_files.py @@ -3,8 +3,8 @@ import io import os import pathlib -from typing import overload -from typing_extensions import TypeGuard +from typing import Sequence, cast, overload +from typing_extensions import TypeVar, TypeGuard import anyio @@ -17,7 +17,9 @@ HttpxFileContent, HttpxRequestFiles, ) -from ._utils import is_tuple_t, is_mapping_t, is_sequence_t +from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t + +_T = TypeVar("_T") def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]: @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent: return await anyio.Path(file).read_bytes() return file + + +def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T: + """Copy only the containers along the given paths. + + Used to guard against mutation by extract_files without copying the entire structure. + Only dicts and lists that lie on a path are copied; everything else + is returned by reference. + + For example, given paths=[["foo", "files", "file"]] and the structure: + { + "foo": { + "bar": {"baz": {}}, + "files": {"file": } + } + } + The root dict, "foo", and "files" are copied (they lie on the path). + "bar" and "baz" are returned by reference (off the path). + """ + return _deepcopy_with_paths(item, paths, 0) + + +def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T: + if not paths: + return item + if is_mapping(item): + key_to_paths: dict[str, list[Sequence[str]]] = {} + for path in paths: + if index < len(path): + key_to_paths.setdefault(path[index], []).append(path) + + # if no path continues through this mapping, it won't be mutated and copying it is redundant + if not key_to_paths: + return item + + result = dict(item) + for key, subpaths in key_to_paths.items(): + if key in result: + result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1) + return cast(_T, result) + if is_list(item): + array_paths = [path for path in paths if index < len(path) and path[index] == ""] + + # if no path expects a list here, nothing will be mutated inside it - return by reference + if not array_paths: + return cast(_T, item) + return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item]) + return item diff --git a/src/docstrange/_utils/__init__.py b/src/docstrange/_utils/__init__.py index 10cb66d..1c090e5 100644 --- a/src/docstrange/_utils/__init__.py +++ b/src/docstrange/_utils/__init__.py @@ -24,7 +24,6 @@ coerce_integer as coerce_integer, file_from_path as file_from_path, strip_not_given as strip_not_given, - deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, maybe_coerce_float as maybe_coerce_float, get_required_header as get_required_header, diff --git a/src/docstrange/_utils/_utils.py b/src/docstrange/_utils/_utils.py index 63b8cd6..771859f 100644 --- a/src/docstrange/_utils/_utils.py +++ b/src/docstrange/_utils/_utils.py @@ -177,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]: return isinstance(obj, Iterable) -def deepcopy_minimal(item: _T) -> _T: - """Minimal reimplementation of copy.deepcopy() that will only copy certain object types: - - - mappings, e.g. `dict` - - list - - This is done for performance reasons. - """ - if is_mapping(item): - return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()}) - if is_list(item): - return cast(_T, [deepcopy_minimal(entry) for entry in item]) - return item - - # copied from https://github.com/Rapptz/RoboDanny def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str: size = len(seq) diff --git a/src/docstrange/resources/classify.py b/src/docstrange/resources/classify.py index 797bf65..fa6ba3c 100644 --- a/src/docstrange/resources/classify.py +++ b/src/docstrange/resources/classify.py @@ -7,8 +7,9 @@ import httpx from ..types import classify_sync_params, classify_batch_params +from .._files import deepcopy_with_paths from .._types import Body, Query, Headers, NotGiven, FileTypes, SequenceNotStr, not_given -from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from .._utils import extract_files, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -75,11 +76,12 @@ def batch( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "categories": categories, "files": files, - } + }, + [["files", ""]], ) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -129,11 +131,12 @@ def sync( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "categories": categories, "file": file, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -202,11 +205,12 @@ async def batch( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "categories": categories, "files": files, - } + }, + [["files", ""]], ) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -256,11 +260,12 @@ async def sync( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "categories": categories, "file": file, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be diff --git a/src/docstrange/resources/extract/extract.py b/src/docstrange/resources/extract/extract.py index 5a0f0fa..f8ccf65 100644 --- a/src/docstrange/resources/extract/extract.py +++ b/src/docstrange/resources/extract/extract.py @@ -16,6 +16,7 @@ ResultsResourceWithStreamingResponse, AsyncResultsResourceWithStreamingResponse, ) +from ..._files import deepcopy_with_paths from ..._types import ( Body, Omit, @@ -27,7 +28,7 @@ omit, not_given, ) -from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from ..._utils import extract_files, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -124,7 +125,7 @@ def async_( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -135,7 +136,8 @@ def async_( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -187,7 +189,7 @@ def batch( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "files": files, "output_format": output_format, @@ -196,7 +198,8 @@ def batch( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["files", ""]], ) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -279,7 +282,7 @@ def stream( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -291,7 +294,8 @@ def stream( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -365,7 +369,7 @@ def sync( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -376,7 +380,8 @@ def sync( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -473,7 +478,7 @@ async def async_( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -484,7 +489,8 @@ async def async_( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -536,7 +542,7 @@ async def batch( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "files": files, "output_format": output_format, @@ -545,7 +551,8 @@ async def batch( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["files", ""]], ) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -628,7 +635,7 @@ async def stream( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -640,7 +647,8 @@ async def stream( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -714,7 +722,7 @@ async def sync( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "output_format": output_format, "csv_options": csv_options, @@ -725,7 +733,8 @@ async def sync( "include_metadata": include_metadata, "json_options": json_options, "prompt_mode": prompt_mode, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py deleted file mode 100644 index 161e489..0000000 --- a/tests/test_deepcopy.py +++ /dev/null @@ -1,58 +0,0 @@ -from docstrange._utils import deepcopy_minimal - - -def assert_different_identities(obj1: object, obj2: object) -> None: - assert obj1 == obj2 - assert id(obj1) != id(obj2) - - -def test_simple_dict() -> None: - obj1 = {"foo": "bar"} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - - -def test_nested_dict() -> None: - obj1 = {"foo": {"bar": True}} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1["foo"], obj2["foo"]) - - -def test_complex_nested_dict() -> None: - obj1 = {"foo": {"bar": [{"hello": "world"}]}} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1["foo"], obj2["foo"]) - assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"]) - assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0]) - - -def test_simple_list() -> None: - obj1 = ["a", "b", "c"] - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - - -def test_nested_list() -> None: - obj1 = ["a", [1, 2, 3]] - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1[1], obj2[1]) - - -class MyObject: ... - - -def test_ignores_other_types() -> None: - # custom classes - my_obj = MyObject() - obj1 = {"foo": my_obj} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert obj1["foo"] is my_obj - - # tuples - obj3 = ("a", "b") - obj4 = deepcopy_minimal(obj3) - assert obj3 is obj4 diff --git a/tests/test_files.py b/tests/test_files.py index 3be2305..077288e 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -4,7 +4,8 @@ import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple -from docstrange._files import to_httpx_files, async_to_httpx_files +from docstrange._files import to_httpx_files, deepcopy_with_paths, async_to_httpx_files +from docstrange._utils import extract_files readme_path = Path(__file__).parent.parent.joinpath("README.md") @@ -49,3 +50,99 @@ def test_string_not_allowed() -> None: "file": "foo", # type: ignore } ) + + +def assert_different_identities(obj1: object, obj2: object) -> None: + assert obj1 == obj2 + assert obj1 is not obj2 + + +class TestDeepcopyWithPaths: + def test_copies_top_level_dict(self) -> None: + original = {"file": b"data", "other": "value"} + result = deepcopy_with_paths(original, [["file"]]) + assert_different_identities(result, original) + + def test_file_value_is_same_reference(self) -> None: + file_bytes = b"contents" + original = {"file": file_bytes} + result = deepcopy_with_paths(original, [["file"]]) + assert_different_identities(result, original) + assert result["file"] is file_bytes + + def test_list_popped_wholesale(self) -> None: + files = [b"f1", b"f2"] + original = {"files": files, "title": "t"} + result = deepcopy_with_paths(original, [["files", ""]]) + assert_different_identities(result, original) + result_files = result["files"] + assert isinstance(result_files, list) + assert_different_identities(result_files, files) + + def test_nested_array_path_copies_list_and_elements(self) -> None: + elem1 = {"file": b"f1", "extra": 1} + elem2 = {"file": b"f2", "extra": 2} + original = {"items": [elem1, elem2]} + result = deepcopy_with_paths(original, [["items", "", "file"]]) + assert_different_identities(result, original) + result_items = result["items"] + assert isinstance(result_items, list) + assert_different_identities(result_items, original["items"]) + assert_different_identities(result_items[0], elem1) + assert_different_identities(result_items[1], elem2) + + def test_empty_paths_returns_same_object(self) -> None: + original = {"foo": "bar"} + result = deepcopy_with_paths(original, []) + assert result is original + + def test_multiple_paths(self) -> None: + f1 = b"file1" + f2 = b"file2" + original = {"a": f1, "b": f2, "c": "unchanged"} + result = deepcopy_with_paths(original, [["a"], ["b"]]) + assert_different_identities(result, original) + assert result["a"] is f1 + assert result["b"] is f2 + assert result["c"] is original["c"] + + def test_extract_files_does_not_mutate_original_top_level(self) -> None: + file_bytes = b"contents" + original = {"file": file_bytes, "other": "value"} + + copied = deepcopy_with_paths(original, [["file"]]) + extracted = extract_files(copied, paths=[["file"]]) + + assert extracted == [("file", file_bytes)] + assert original == {"file": file_bytes, "other": "value"} + assert copied == {"other": "value"} + + def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None: + file1 = b"f1" + file2 = b"f2" + original = { + "items": [ + {"file": file1, "extra": 1}, + {"file": file2, "extra": 2}, + ], + "title": "example", + } + + copied = deepcopy_with_paths(original, [["items", "", "file"]]) + extracted = extract_files(copied, paths=[["items", "", "file"]]) + + assert extracted == [("items[][file]", file1), ("items[][file]", file2)] + assert original == { + "items": [ + {"file": file1, "extra": 1}, + {"file": file2, "extra": 2}, + ], + "title": "example", + } + assert copied == { + "items": [ + {"extra": 1}, + {"extra": 2}, + ], + "title": "example", + } From a0dcb1826dc9d9a12cdf090be8c8364b281ca3fa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 08:25:22 +0000 Subject: [PATCH 26/26] release: 0.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 40 +++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/docstrange/_version.py | 2 +- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5547f83..10f3091 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.1" + ".": "0.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d37168a..b3d10c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## 0.2.0 (2026-04-18) + +Full Changelog: [v0.1.1...v0.2.0](https://github.com/NanoNets/docstrange-python/compare/v0.1.1...v0.2.0) + +### Features + +* **internal:** implement indices array format for query and form serialization ([2790680](https://github.com/NanoNets/docstrange-python/commit/279068029d8c1533c1058b6daf50415c96a7d793)) + + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([e0ff6ac](https://github.com/NanoNets/docstrange-python/commit/e0ff6ac6cfea51d7a15a2020241444bab09db5e9)) +* **deps:** bump minimum typing-extensions version ([3293c84](https://github.com/NanoNets/docstrange-python/commit/3293c8459d7cd5831d9497fe222d5b2479ceba6a)) +* ensure file data are only sent as 1 parameter ([704c186](https://github.com/NanoNets/docstrange-python/commit/704c186421bdedbacdd109e359ed3005ba053f6e)) +* **pydantic:** do not pass `by_alias` unless set ([8281a9a](https://github.com/NanoNets/docstrange-python/commit/8281a9a9ca7f2b2e97a11eccbb27c26445f8b741)) +* sanitize endpoint path params ([2529403](https://github.com/NanoNets/docstrange-python/commit/2529403cdb31e5f4591924947c9c9f281f3cf7de)) + + +### Chores + +* **ci:** bump uv version ([c323a36](https://github.com/NanoNets/docstrange-python/commit/c323a36839f55b7a9d64749b57c109cdfac3242d)) +* **ci:** skip lint on metadata-only changes ([aa1f737](https://github.com/NanoNets/docstrange-python/commit/aa1f737af893ccd0ff6b86e39f3273fc4d01eff5)) +* **ci:** skip uploading artifacts on stainless-internal branches ([c4ae12c](https://github.com/NanoNets/docstrange-python/commit/c4ae12c45ae60c005b25136b1fe1a1357966b7cf)) +* format all `api.md` files ([181d23f](https://github.com/NanoNets/docstrange-python/commit/181d23f1cb3ba49a4f9e1b15904b6f554d45c47e)) +* **internal:** add request options to SSE classes ([db43c2d](https://github.com/NanoNets/docstrange-python/commit/db43c2d91944f4dbfa4c10a29ae9710d72ac354d)) +* **internal:** codegen related update ([ddfbedf](https://github.com/NanoNets/docstrange-python/commit/ddfbedf1d6de0be142fc73ad1874d001a723c32f)) +* **internal:** make `test_proxy_environment_variables` more resilient ([813e69d](https://github.com/NanoNets/docstrange-python/commit/813e69df0940d2528b14f076b9583d90edffd2a2)) +* **internal:** make `test_proxy_environment_variables` more resilient to env ([135f28b](https://github.com/NanoNets/docstrange-python/commit/135f28ba8d42802aeaf25a2a0e4b04189390c0b8)) +* **internal:** refactor authentication internals ([d91fcfa](https://github.com/NanoNets/docstrange-python/commit/d91fcfa6b17d19771a43c30af59d1eff3b484931)) +* **internal:** remove mock server code ([7ca1623](https://github.com/NanoNets/docstrange-python/commit/7ca1623eaa59ff51c76aa66a948052487416f767)) +* **internal:** tweak CI branches ([cb69cd0](https://github.com/NanoNets/docstrange-python/commit/cb69cd0526fbc4a37ea880f06729681921589a1f)) +* **internal:** update gitignore ([d1375ed](https://github.com/NanoNets/docstrange-python/commit/d1375ede29d45d13aba9f38066e35f61433c0641)) +* **internal:** version bump ([bccc6c4](https://github.com/NanoNets/docstrange-python/commit/bccc6c4c4c5784dfd388395ff5e429ed8348ddf3)) +* **test:** update skip reason message ([abd2c81](https://github.com/NanoNets/docstrange-python/commit/abd2c81bcd43080e8bf606af12e8d4b9889e62a1)) +* update mock server docs ([4b3083c](https://github.com/NanoNets/docstrange-python/commit/4b3083c18f27cede567c9ee00186c4c69723dc92)) +* update placeholder string ([c15515a](https://github.com/NanoNets/docstrange-python/commit/c15515aa7218d4d07c85543c0438539e339c5d44)) +* update SDK settings ([1dafac3](https://github.com/NanoNets/docstrange-python/commit/1dafac38b9d0a26e55a15e6ca90954ae3ac186e1)) +* update SDK settings ([7c6f5e0](https://github.com/NanoNets/docstrange-python/commit/7c6f5e0d4eede9a88ec92a25071922644f473433)) +* update SDK settings ([c87d8ae](https://github.com/NanoNets/docstrange-python/commit/c87d8aede4de4ba2865222011cd7b28202d0d2d1)) + ## 0.1.1 (2026-02-13) Full Changelog: [v0.1.0...v0.1.1](https://github.com/NanoNets/docstrange-python/compare/v0.1.0...v0.1.1) diff --git a/pyproject.toml b/pyproject.toml index d213f7d..d8a2d5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "docstrange-api" -version = "0.1.1" +version = "0.2.0" description = "The official Python library for the docstrange API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/docstrange/_version.py b/src/docstrange/_version.py index cb7a2af..a966d6c 100644 --- a/src/docstrange/_version.py +++ b/src/docstrange/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "docstrange" -__version__ = "0.1.1" # x-release-please-version +__version__ = "0.2.0" # x-release-please-version