From caea803e4fc873ade6fbc9b9b66ff67938780f65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 03:57:32 +0000 Subject: [PATCH 01/18] 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 071a7bc..61e5adb 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -927,8 +927,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() @@ -1821,8 +1827,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 39d55bd0441b3ab5220f130abd12dad63adecef2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 21:27:10 +0000 Subject: [PATCH 02/18] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2702d73..3004020 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer%2Funlayer-48f00d1c04c23fb4d1cb7cf4af4f56b0c920d758c1f06e06e5373e5b15e9c27d.yml openapi_spec_hash: 6ee2a94bb9840aceb4a6161c724ce46c -config_hash: 249869757b6eb98ae3d58f2a47ce21e2 +config_hash: c8d97d58d67dad9eeb65eb58fc781724 From d58e1b80f026a3fbb93c51e57af8afedcdb866e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 05:10:26 +0000 Subject: [PATCH 03/18] chore(internal): codegen related update --- src/unlayer/_client.py | 18 ++++++++++++++++++ src/unlayer/resources/convert/convert.py | 12 ++++++++++++ .../resources/convert/full_to_simple.py | 4 ++++ .../resources/convert/simple_to_full.py | 4 ++++ src/unlayer/resources/projects.py | 4 ++++ src/unlayer/resources/templates.py | 4 ++++ src/unlayer/resources/workspaces.py | 4 ++++ 7 files changed, 50 insertions(+) diff --git a/src/unlayer/_client.py b/src/unlayer/_client.py index 08f7fef..2c20382 100644 --- a/src/unlayer/_client.py +++ b/src/unlayer/_client.py @@ -115,18 +115,21 @@ def convert(self) -> ConvertResource: @cached_property def projects(self) -> ProjectsResource: + """Project details and configuration.""" from .resources.projects import ProjectsResource return ProjectsResource(self) @cached_property def templates(self) -> TemplatesResource: + """Template management and retrieval.""" from .resources.templates import TemplatesResource return TemplatesResource(self) @cached_property def workspaces(self) -> WorkspacesResource: + """Workspace access and management.""" from .resources.workspaces import WorkspacesResource return WorkspacesResource(self) @@ -345,18 +348,21 @@ def convert(self) -> AsyncConvertResource: @cached_property def projects(self) -> AsyncProjectsResource: + """Project details and configuration.""" from .resources.projects import AsyncProjectsResource return AsyncProjectsResource(self) @cached_property def templates(self) -> AsyncTemplatesResource: + """Template management and retrieval.""" from .resources.templates import AsyncTemplatesResource return AsyncTemplatesResource(self) @cached_property def workspaces(self) -> AsyncWorkspacesResource: + """Workspace access and management.""" from .resources.workspaces import AsyncWorkspacesResource return AsyncWorkspacesResource(self) @@ -515,18 +521,21 @@ def convert(self) -> convert.ConvertResourceWithRawResponse: @cached_property def projects(self) -> projects.ProjectsResourceWithRawResponse: + """Project details and configuration.""" from .resources.projects import ProjectsResourceWithRawResponse return ProjectsResourceWithRawResponse(self._client.projects) @cached_property def templates(self) -> templates.TemplatesResourceWithRawResponse: + """Template management and retrieval.""" from .resources.templates import TemplatesResourceWithRawResponse return TemplatesResourceWithRawResponse(self._client.templates) @cached_property def workspaces(self) -> workspaces.WorkspacesResourceWithRawResponse: + """Workspace access and management.""" from .resources.workspaces import WorkspacesResourceWithRawResponse return WorkspacesResourceWithRawResponse(self._client.workspaces) @@ -546,18 +555,21 @@ def convert(self) -> convert.AsyncConvertResourceWithRawResponse: @cached_property def projects(self) -> projects.AsyncProjectsResourceWithRawResponse: + """Project details and configuration.""" from .resources.projects import AsyncProjectsResourceWithRawResponse return AsyncProjectsResourceWithRawResponse(self._client.projects) @cached_property def templates(self) -> templates.AsyncTemplatesResourceWithRawResponse: + """Template management and retrieval.""" from .resources.templates import AsyncTemplatesResourceWithRawResponse return AsyncTemplatesResourceWithRawResponse(self._client.templates) @cached_property def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithRawResponse: + """Workspace access and management.""" from .resources.workspaces import AsyncWorkspacesResourceWithRawResponse return AsyncWorkspacesResourceWithRawResponse(self._client.workspaces) @@ -577,18 +589,21 @@ def convert(self) -> convert.ConvertResourceWithStreamingResponse: @cached_property def projects(self) -> projects.ProjectsResourceWithStreamingResponse: + """Project details and configuration.""" from .resources.projects import ProjectsResourceWithStreamingResponse return ProjectsResourceWithStreamingResponse(self._client.projects) @cached_property def templates(self) -> templates.TemplatesResourceWithStreamingResponse: + """Template management and retrieval.""" from .resources.templates import TemplatesResourceWithStreamingResponse return TemplatesResourceWithStreamingResponse(self._client.templates) @cached_property def workspaces(self) -> workspaces.WorkspacesResourceWithStreamingResponse: + """Workspace access and management.""" from .resources.workspaces import WorkspacesResourceWithStreamingResponse return WorkspacesResourceWithStreamingResponse(self._client.workspaces) @@ -608,18 +623,21 @@ def convert(self) -> convert.AsyncConvertResourceWithStreamingResponse: @cached_property def projects(self) -> projects.AsyncProjectsResourceWithStreamingResponse: + """Project details and configuration.""" from .resources.projects import AsyncProjectsResourceWithStreamingResponse return AsyncProjectsResourceWithStreamingResponse(self._client.projects) @cached_property def templates(self) -> templates.AsyncTemplatesResourceWithStreamingResponse: + """Template management and retrieval.""" from .resources.templates import AsyncTemplatesResourceWithStreamingResponse return AsyncTemplatesResourceWithStreamingResponse(self._client.templates) @cached_property def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithStreamingResponse: + """Workspace access and management.""" from .resources.workspaces import AsyncWorkspacesResourceWithStreamingResponse return AsyncWorkspacesResourceWithStreamingResponse(self._client.workspaces) diff --git a/src/unlayer/resources/convert/convert.py b/src/unlayer/resources/convert/convert.py index 08eee7c..e4fdfc7 100644 --- a/src/unlayer/resources/convert/convert.py +++ b/src/unlayer/resources/convert/convert.py @@ -27,10 +27,12 @@ class ConvertResource(SyncAPIResource): @cached_property def full_to_simple(self) -> FullToSimpleResource: + """Design schema conversion between Full and Simple formats.""" return FullToSimpleResource(self._client) @cached_property def simple_to_full(self) -> SimpleToFullResource: + """Design schema conversion between Full and Simple formats.""" return SimpleToFullResource(self._client) @cached_property @@ -56,10 +58,12 @@ def with_streaming_response(self) -> ConvertResourceWithStreamingResponse: class AsyncConvertResource(AsyncAPIResource): @cached_property def full_to_simple(self) -> AsyncFullToSimpleResource: + """Design schema conversion between Full and Simple formats.""" return AsyncFullToSimpleResource(self._client) @cached_property def simple_to_full(self) -> AsyncSimpleToFullResource: + """Design schema conversion between Full and Simple formats.""" return AsyncSimpleToFullResource(self._client) @cached_property @@ -88,10 +92,12 @@ def __init__(self, convert: ConvertResource) -> None: @cached_property def full_to_simple(self) -> FullToSimpleResourceWithRawResponse: + """Design schema conversion between Full and Simple formats.""" return FullToSimpleResourceWithRawResponse(self._convert.full_to_simple) @cached_property def simple_to_full(self) -> SimpleToFullResourceWithRawResponse: + """Design schema conversion between Full and Simple formats.""" return SimpleToFullResourceWithRawResponse(self._convert.simple_to_full) @@ -101,10 +107,12 @@ def __init__(self, convert: AsyncConvertResource) -> None: @cached_property def full_to_simple(self) -> AsyncFullToSimpleResourceWithRawResponse: + """Design schema conversion between Full and Simple formats.""" return AsyncFullToSimpleResourceWithRawResponse(self._convert.full_to_simple) @cached_property def simple_to_full(self) -> AsyncSimpleToFullResourceWithRawResponse: + """Design schema conversion between Full and Simple formats.""" return AsyncSimpleToFullResourceWithRawResponse(self._convert.simple_to_full) @@ -114,10 +122,12 @@ def __init__(self, convert: ConvertResource) -> None: @cached_property def full_to_simple(self) -> FullToSimpleResourceWithStreamingResponse: + """Design schema conversion between Full and Simple formats.""" return FullToSimpleResourceWithStreamingResponse(self._convert.full_to_simple) @cached_property def simple_to_full(self) -> SimpleToFullResourceWithStreamingResponse: + """Design schema conversion between Full and Simple formats.""" return SimpleToFullResourceWithStreamingResponse(self._convert.simple_to_full) @@ -127,8 +137,10 @@ def __init__(self, convert: AsyncConvertResource) -> None: @cached_property def full_to_simple(self) -> AsyncFullToSimpleResourceWithStreamingResponse: + """Design schema conversion between Full and Simple formats.""" return AsyncFullToSimpleResourceWithStreamingResponse(self._convert.full_to_simple) @cached_property def simple_to_full(self) -> AsyncSimpleToFullResourceWithStreamingResponse: + """Design schema conversion between Full and Simple formats.""" return AsyncSimpleToFullResourceWithStreamingResponse(self._convert.simple_to_full) diff --git a/src/unlayer/resources/convert/full_to_simple.py b/src/unlayer/resources/convert/full_to_simple.py index d5901f4..35ea241 100644 --- a/src/unlayer/resources/convert/full_to_simple.py +++ b/src/unlayer/resources/convert/full_to_simple.py @@ -24,6 +24,8 @@ class FullToSimpleResource(SyncAPIResource): + """Design schema conversion between Full and Simple formats.""" + @cached_property def with_raw_response(self) -> FullToSimpleResourceWithRawResponse: """ @@ -91,6 +93,8 @@ def create( class AsyncFullToSimpleResource(AsyncAPIResource): + """Design schema conversion between Full and Simple formats.""" + @cached_property def with_raw_response(self) -> AsyncFullToSimpleResourceWithRawResponse: """ diff --git a/src/unlayer/resources/convert/simple_to_full.py b/src/unlayer/resources/convert/simple_to_full.py index d9b634f..5f22bb0 100644 --- a/src/unlayer/resources/convert/simple_to_full.py +++ b/src/unlayer/resources/convert/simple_to_full.py @@ -24,6 +24,8 @@ class SimpleToFullResource(SyncAPIResource): + """Design schema conversion between Full and Simple formats.""" + @cached_property def with_raw_response(self) -> SimpleToFullResourceWithRawResponse: """ @@ -86,6 +88,8 @@ def create( class AsyncSimpleToFullResource(AsyncAPIResource): + """Design schema conversion between Full and Simple formats.""" + @cached_property def with_raw_response(self) -> AsyncSimpleToFullResourceWithRawResponse: """ diff --git a/src/unlayer/resources/projects.py b/src/unlayer/resources/projects.py index 59073ac..4025c8c 100644 --- a/src/unlayer/resources/projects.py +++ b/src/unlayer/resources/projects.py @@ -20,6 +20,8 @@ class ProjectsResource(SyncAPIResource): + """Project details and configuration.""" + @cached_property def with_raw_response(self) -> ProjectsResourceWithRawResponse: """ @@ -74,6 +76,8 @@ def retrieve( class AsyncProjectsResource(AsyncAPIResource): + """Project details and configuration.""" + @cached_property def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: """ diff --git a/src/unlayer/resources/templates.py b/src/unlayer/resources/templates.py index e41c931..ebfb4a0 100644 --- a/src/unlayer/resources/templates.py +++ b/src/unlayer/resources/templates.py @@ -26,6 +26,8 @@ class TemplatesResource(SyncAPIResource): + """Template management and retrieval.""" + @cached_property def with_raw_response(self) -> TemplatesResourceWithRawResponse: """ @@ -148,6 +150,8 @@ def list( class AsyncTemplatesResource(AsyncAPIResource): + """Template management and retrieval.""" + @cached_property def with_raw_response(self) -> AsyncTemplatesResourceWithRawResponse: """ diff --git a/src/unlayer/resources/workspaces.py b/src/unlayer/resources/workspaces.py index 3bce476..be859fc 100644 --- a/src/unlayer/resources/workspaces.py +++ b/src/unlayer/resources/workspaces.py @@ -21,6 +21,8 @@ class WorkspacesResource(SyncAPIResource): + """Workspace access and management.""" + @cached_property def with_raw_response(self) -> WorkspacesResourceWithRawResponse: """ @@ -100,6 +102,8 @@ def list( class AsyncWorkspacesResource(AsyncAPIResource): + """Workspace access and management.""" + @cached_property def with_raw_response(self) -> AsyncWorkspacesResourceWithRawResponse: """ From 19677f4a04cd989500eecce93cbb0506cf1ebf32 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 05:12:47 +0000 Subject: [PATCH 04/18] refactor(types): use `extra_items` from PEP 728 --- .../types/convert/full_to_simple_create_params.py | 9 +++------ .../types/convert/simple_to_full_create_params.py | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/unlayer/types/convert/full_to_simple_create_params.py b/src/unlayer/types/convert/full_to_simple_create_params.py index 7038dcf..5d70ae7 100644 --- a/src/unlayer/types/convert/full_to_simple_create_params.py +++ b/src/unlayer/types/convert/full_to_simple_create_params.py @@ -2,8 +2,8 @@ from __future__ import annotations -from typing import Dict, Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict +from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -25,12 +25,9 @@ class FullToSimpleCreateParams(TypedDict, total=False): include_default_values: Annotated[bool, PropertyInfo(alias="includeDefaultValues")] -class DesignTyped(TypedDict, total=False): +class Design(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] body: Required[Dict[str, object]] counters: Dict[str, object] schema_version: Annotated[float, PropertyInfo(alias="schemaVersion")] - - -Design: TypeAlias = Union[DesignTyped, Dict[str, object]] diff --git a/src/unlayer/types/convert/simple_to_full_create_params.py b/src/unlayer/types/convert/simple_to_full_create_params.py index 247905e..b973376 100644 --- a/src/unlayer/types/convert/simple_to_full_create_params.py +++ b/src/unlayer/types/convert/simple_to_full_create_params.py @@ -2,8 +2,8 @@ from __future__ import annotations -from typing import Dict, Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict +from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -24,7 +24,7 @@ class Design_Conversion(TypedDict, total=False): version: float -class DesignTyped(TypedDict, total=False): +class Design(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] body: Required[Dict[str, object]] _conversion: Design_Conversion @@ -32,6 +32,3 @@ class DesignTyped(TypedDict, total=False): counters: Dict[str, object] schema_version: Annotated[float, PropertyInfo(alias="schemaVersion")] - - -Design: TypeAlias = Union[DesignTyped, Dict[str, object]] From 3ad7bbb203d27a7b7f69fda2d0f3aebea329c49e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 05:30:01 +0000 Subject: [PATCH 05/18] chore(test): do not count install time for mock server timeout --- scripts/mock | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 0b28f6e..bcf3b39 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done From 907041a9070f3c4a86605a21c9ab9a004a9bf553 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 16:13:42 +0000 Subject: [PATCH 06/18] 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 e5caf73..55b6ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/unlayer-python' + if: |- + github.repository == 'stainless-sdks/unlayer-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/unlayer-python' + if: |- + github.repository == 'stainless-sdks/unlayer-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From d31637bd182be359df4af936cb715cc554d9a14b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:10:56 +0000 Subject: [PATCH 07/18] fix(pydantic): do not pass `by_alias` unless set --- src/unlayer/_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/unlayer/_compat.py b/src/unlayer/_compat.py index 786ff42..e6690a4 100644 --- a/src/unlayer/_compat.py +++ b/src/unlayer/_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 b7baa1e5d138b5a33b63bed9dae37bfabb6d968d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:16:28 +0000 Subject: [PATCH 08/18] fix(deps): bump minimum typing-extensions version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cbb8b33..967cabc 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", From 4e152dccd0191c2dd4d321e8ca7b6550dc6bc3f0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:20:31 +0000 Subject: [PATCH 09/18] 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 55b6ef5..581125c 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 bc0d6b6b147d33cd2f65855284e7f435bdee09f9 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:23:13 +0000 Subject: [PATCH 10/18] fix: sanitize endpoint path params --- src/unlayer/_utils/__init__.py | 1 + src/unlayer/_utils/_path.py | 127 ++++++++++++++++++++++++++++ src/unlayer/resources/projects.py | 5 +- src/unlayer/resources/templates.py | 6 +- src/unlayer/resources/workspaces.py | 5 +- tests/test_utils/test_path.py | 89 +++++++++++++++++++ 6 files changed, 226 insertions(+), 7 deletions(-) create mode 100644 src/unlayer/_utils/_path.py create mode 100644 tests/test_utils/test_path.py diff --git a/src/unlayer/_utils/__init__.py b/src/unlayer/_utils/__init__.py index dc64e29..10cb66d 100644 --- a/src/unlayer/_utils/__init__.py +++ b/src/unlayer/_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/unlayer/_utils/_path.py b/src/unlayer/_utils/_path.py new file mode 100644 index 0000000..4d6e1e4 --- /dev/null +++ b/src/unlayer/_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/unlayer/resources/projects.py b/src/unlayer/resources/projects.py index 4025c8c..f842cfe 100644 --- a/src/unlayer/resources/projects.py +++ b/src/unlayer/resources/projects.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -67,7 +68,7 @@ def retrieve( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._get( - f"/v3/projects/{id}", + path_template("/v3/projects/{id}", id=id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +124,7 @@ async def retrieve( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._get( - f"/v3/projects/{id}", + path_template("/v3/projects/{id}", id=id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/unlayer/resources/templates.py b/src/unlayer/resources/templates.py index ebfb4a0..75fcee7 100644 --- a/src/unlayer/resources/templates.py +++ b/src/unlayer/resources/templates.py @@ -8,7 +8,7 @@ from ..types import template_list_params, template_retrieve_params 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 ( @@ -76,7 +76,7 @@ def retrieve( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._get( - f"/v3/templates/{id}", + path_template("/v3/templates/{id}", id=id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -200,7 +200,7 @@ async def retrieve( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._get( - f"/v3/templates/{id}", + path_template("/v3/templates/{id}", id=id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/unlayer/resources/workspaces.py b/src/unlayer/resources/workspaces.py index be859fc..3ad5619 100644 --- a/src/unlayer/resources/workspaces.py +++ b/src/unlayer/resources/workspaces.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +71,7 @@ def retrieve( if not workspace_id: raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") return self._get( - f"/v3/workspaces/{workspace_id}", + path_template("/v3/workspaces/{workspace_id}", workspace_id=workspace_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +152,7 @@ async def retrieve( if not workspace_id: raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") return await self._get( - f"/v3/workspaces/{workspace_id}", + path_template("/v3/workspaces/{workspace_id}", workspace_id=workspace_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 0000000..8d48732 --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from unlayer._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 d2618bd109fcd053b5845009bc8221090930a369 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:24:04 +0000 Subject: [PATCH 11/18] refactor(tests): switch from prism to steady --- CONTRIBUTING.md | 2 +- scripts/mock | 26 +++++++++++++------------- scripts/test | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f8a253..38563d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,7 +85,7 @@ $ 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. +Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests. ```sh $ ./scripts/mock diff --git a/scripts/mock b/scripts/mock index bcf3b39..38201de 100755 --- a/scripts/mock +++ b/scripts/mock @@ -19,34 +19,34 @@ fi echo "==> Starting mock server with URL ${URL}" -# Run prism mock on the given spec +# Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stdy/cli@0.19.3 -- steady --version - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets "$URL" &> .stdy.log & - # Wait for server to come online (max 30s) + # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi attempts=$((attempts + 1)) if [ "$attempts" -ge 300 ]; then echo - echo "Timed out waiting for Prism server to start" - cat .prism.log + echo "Timed out waiting for Steady server to start" + cat .stdy.log exit 1 fi 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" + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index dbeda2d..2dfdc40 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,8 @@ 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 +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -25,7 +25,7 @@ function is_overriding_api_base_url() { [ -n "$TEST_API_BASE_URL" ] } -if ! is_overriding_api_base_url && ! prism_is_running ; then +if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process trap 'kill_server_on_port 4010' EXIT @@ -36,19 +36,19 @@ 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" +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady 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 -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets${NC}" echo exit 1 else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" echo fi From 775fe461f02f96ebc4b7cd6ff2d8cab4c52d291d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 04:17:12 +0000 Subject: [PATCH 12/18] chore(tests): bump steady to v0.19.4 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 38201de..e1c19e8 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.3 -- steady --version + npm exec --package=@stdy/cli@0.19.4 -- steady --version - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 2dfdc40..36fab0a 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.4 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 9ef3615041ea171a462a29f8cfd268133df0c6fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 04:21:49 +0000 Subject: [PATCH 13/18] chore(tests): bump steady to v0.19.5 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index e1c19e8..ab814d3 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.4 -- steady --version + npm exec --package=@stdy/cli@0.19.5 -- steady --version - npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 36fab0a..d1c8e1a 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.4 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 5a510e6edf2e26d612be067b6c95e70780d01d57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:19:54 +0000 Subject: [PATCH 14/18] 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 33d721e46826c23bf5b1ce78477d003cb9cd83da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:25:10 +0000 Subject: [PATCH 15/18] chore(tests): bump steady to v0.19.6 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index ab814d3..b319bdf 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.5 -- steady --version + npm exec --package=@stdy/cli@0.19.6 -- steady --version - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index d1c8e1a..ab01948 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 33434927ad6ab7c508d758335944cdc4123a5e17 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:05:16 +0000 Subject: [PATCH 16/18] 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 581125c..cb10d13 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/unlayer-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 @@ -38,7 +38,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 3d09621f6d61c74d431b9af1336c6c51d8396d4f 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:05:49 +0000 Subject: [PATCH 17/18] chore(tests): bump steady to v0.19.7 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index b319bdf..09eb49f 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.6 -- steady --version + npm exec --package=@stdy/cli@0.19.7 -- steady --version - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index ab01948..e46b9b5 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 121bee3f175b6fd2b751defb39c64666815a006a 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:06:24 +0000 Subject: [PATCH 18/18] release: 0.1.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/unlayer/_version.py | 2 +- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d2ac0b..5547f83 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.1.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3935a47..c8b4853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## 0.1.1 (2026-03-25) + +Full Changelog: [v0.1.0...v0.1.1](https://github.com/unlayer/unlayer-python/compare/v0.1.0...v0.1.1) + +### Bug Fixes + +* **deps:** bump minimum typing-extensions version ([b7baa1e](https://github.com/unlayer/unlayer-python/commit/b7baa1e5d138b5a33b63bed9dae37bfabb6d968d)) +* **pydantic:** do not pass `by_alias` unless set ([d31637b](https://github.com/unlayer/unlayer-python/commit/d31637bd182be359df4af936cb715cc554d9a14b)) +* sanitize endpoint path params ([bc0d6b6](https://github.com/unlayer/unlayer-python/commit/bc0d6b6b147d33cd2f65855284e7f435bdee09f9)) + + +### Chores + +* **ci:** skip lint on metadata-only changes ([3343492](https://github.com/unlayer/unlayer-python/commit/33434927ad6ab7c508d758335944cdc4123a5e17)) +* **ci:** skip uploading artifacts on stainless-internal branches ([907041a](https://github.com/unlayer/unlayer-python/commit/907041a9070f3c4a86605a21c9ab9a004a9bf553)) +* **internal:** codegen related update ([d58e1b8](https://github.com/unlayer/unlayer-python/commit/d58e1b80f026a3fbb93c51e57af8afedcdb866e9)) +* **internal:** make `test_proxy_environment_variables` more resilient to env ([caea803](https://github.com/unlayer/unlayer-python/commit/caea803e4fc873ade6fbc9b9b66ff67938780f65)) +* **internal:** tweak CI branches ([4e152dc](https://github.com/unlayer/unlayer-python/commit/4e152dccd0191c2dd4d321e8ca7b6550dc6bc3f0)) +* **internal:** update gitignore ([5a510e6](https://github.com/unlayer/unlayer-python/commit/5a510e6edf2e26d612be067b6c95e70780d01d57)) +* **test:** do not count install time for mock server timeout ([3ad7bbb](https://github.com/unlayer/unlayer-python/commit/3ad7bbb203d27a7b7f69fda2d0f3aebea329c49e)) +* **tests:** bump steady to v0.19.4 ([775fe46](https://github.com/unlayer/unlayer-python/commit/775fe461f02f96ebc4b7cd6ff2d8cab4c52d291d)) +* **tests:** bump steady to v0.19.5 ([9ef3615](https://github.com/unlayer/unlayer-python/commit/9ef3615041ea171a462a29f8cfd268133df0c6fc)) +* **tests:** bump steady to v0.19.6 ([33d721e](https://github.com/unlayer/unlayer-python/commit/33d721e46826c23bf5b1ce78477d003cb9cd83da)) +* **tests:** bump steady to v0.19.7 ([3d09621](https://github.com/unlayer/unlayer-python/commit/3d09621f6d61c74d431b9af1336c6c51d8396d4f)) + + +### Refactors + +* **tests:** switch from prism to steady ([d2618bd](https://github.com/unlayer/unlayer-python/commit/d2618bd109fcd053b5845009bc8221090930a369)) +* **types:** use `extra_items` from PEP 728 ([19677f4](https://github.com/unlayer/unlayer-python/commit/19677f4a04cd989500eecce93cbb0506cf1ebf32)) + ## 0.1.0 (2026-02-24) Full Changelog: [v0.0.1...v0.1.0](https://github.com/unlayer/unlayer-python/compare/v0.0.1...v0.1.0) diff --git a/pyproject.toml b/pyproject.toml index 967cabc..3ede640 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "unlayer" -version = "0.1.0" +version = "0.1.1" description = "The official Python library for the unlayer API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/unlayer/_version.py b/src/unlayer/_version.py index 47398ca..a00fd7f 100644 --- a/src/unlayer/_version.py +++ b/src/unlayer/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "unlayer" -__version__ = "0.1.0" # x-release-please-version +__version__ = "0.1.1" # x-release-please-version