diff --git a/CHANGELOG.md b/CHANGELOG.md index 4609f19..136d506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Python SDK floor bumped to `youdotcom>=3.1.2,<4` (was `>=3.0.0,<4`). The 3.1.2 release ships the `X-Client-Info` attribution header and the `app_name` / `app_version` / `app_title` / `app_url` constructor kwargs on `You` +- The plugin now passes `app_name="youdotcom-temporal"` and `app_version=` to the `You(...)` constructor instead of mutating `client.sdk_configuration.user_agent` post-construction. Each outbound request carries `X-Client-Info: sdk; client=youdotcom-temporal/; ua=python/ httpx/`; the SDK's own `user-agent` stays as `youdotcom-python-sdk/`. The `_USER_AGENT` constant is removed + ## [1.0.1] — 2026-08-18 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 926773b..61895c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ # Floor, not a pin: SimplePlugin needs 1.19.0+; use a recent stable floor and # let CI test the latest. Upper bound only guards the next major. "temporalio>=1.27.0,<2", - "youdotcom>=3.0.0,<4", + "youdotcom>=3.1.2,<4", ] [project.urls] diff --git a/src/youdotcom_temporal/_client.py b/src/youdotcom_temporal/_client.py index 21a687a..2339e2a 100644 --- a/src/youdotcom_temporal/_client.py +++ b/src/youdotcom_temporal/_client.py @@ -8,7 +8,12 @@ from . import __version__ from .config import YouConfig -_USER_AGENT = f"youdotcom-temporal/{__version__}" +# Caller-identity segments emitted in the SDK's ``X-Client-Info`` header on +# every outbound request (shipped in youdotcom 3.1.2). The SDK keeps its own +# ``user-agent`` as ``youdotcom-python-sdk/``; the plugin identity rides +# the attribution header instead. +_APP_NAME = "youdotcom-temporal" +_APP_VERSION = __version__ @asynccontextmanager @@ -17,10 +22,11 @@ async def you_client(cfg: YouConfig) -> AsyncIterator[You]: "api_key_auth": cfg.api_key, "retry_config": None, "timeout_ms": int(cfg.timeout_seconds * 1000), + "app_name": _APP_NAME, + "app_version": _APP_VERSION, } if cfg.server_url: kwargs["server_url"] = cfg.server_url client = You(**kwargs) # type: ignore[arg-type] - client.sdk_configuration.user_agent = _USER_AGENT async with client as entered: yield entered diff --git a/tests/test_client.py b/tests/test_client.py index ac63f7b..ec90868 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -3,7 +3,7 @@ from unittest.mock import AsyncMock, patch from youdotcom_temporal import __version__ -from youdotcom_temporal._client import _USER_AGENT, you_client +from youdotcom_temporal._client import you_client from youdotcom_temporal.config import YouConfig @@ -23,6 +23,8 @@ async def test_client_kwargs_without_server_url(): "api_key_auth": "k", "retry_config": None, "timeout_ms": 30000, + "app_name": "youdotcom-temporal", + "app_version": __version__, } async def test_client_default_timeout_is_300s(): @@ -43,18 +45,11 @@ async def test_client_includes_server_url_when_set(): "api_key_auth": "k", "retry_config": None, "timeout_ms": 5000, + "app_name": "youdotcom-temporal", + "app_version": __version__, "server_url": "https://custom", } -async def test_client_sets_custom_user_agent(): - cfg = YouConfig(api_key="k", timeout_seconds=30.0) - fake = _fake_you() - with patch("youdotcom_temporal._client.You", return_value=fake): - async with you_client(cfg): - pass - assert fake.sdk_configuration.user_agent == _USER_AGENT - - -def test_user_agent_includes_package_version(): - assert _USER_AGENT == f"youdotcom-temporal/{__version__}" +def test_attribution_header_includes_package_version(): + assert __version__ != "0.0.0-dev" diff --git a/uv.lock b/uv.lock index 58e1913..8f557ca 100644 --- a/uv.lock +++ b/uv.lock @@ -757,16 +757,16 @@ wheels = [ [[package]] name = "youdotcom" -version = "3.0.0" +version = "3.1.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "httpcore" }, { name = "httpx" }, { name = "pydantic" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/27/78/841c142d36037411e6c8d461e4b2e9ffcf106d46c3d3271e2208e2fc47c0/youdotcom-3.0.0.tar.gz", hash = "sha256:e425805ab11b9e7221ecd766f2fe55fe950cb8ed6e4da17d50b8a96ea93d42ab", size = 106479, upload-time = "2026-08-06T18:05:46.89Z" } +sdist = { url = "https://files.pythonhosted.org/packages/2d/99/77c5b7246ca4ffbb0ae0fc98757836b2a6cd114e2454e2bc73cd52c2bef0/youdotcom-3.1.2.tar.gz", hash = "sha256:73b4801203b6fca15f0531c5c34ae1dc680d2d41edf83748f572023c6137916d", size = 141929, upload-time = "2026-08-21T06:46:55.788Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/2a/81/da737799f0e1ac01eaaa41a2ef14ef43ecd68d7d494eb76108e329499046/youdotcom-3.0.0-py3-none-any.whl", hash = "sha256:141c601ef8a9e448348b96dc585e00792d3ef597bc26e6429bbb8570b0037e99", size = 99999, upload-time = "2026-08-06T18:05:45.689Z" }, + { url = "https://files.pythonhosted.org/packages/e8/bb/258571903378fc865b87b3749c460dad7a8534bbccf8c4a3873203359536/youdotcom-3.1.2-py3-none-any.whl", hash = "sha256:1ef5c66871e0fe3320d5fa0869ba59420511560648e9fb793f9c7f1e0e7d641c", size = 114867, upload-time = "2026-08-21T06:46:54.5Z" }, ] [[package]] @@ -789,7 +789,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "temporalio", specifier = ">=1.27.0,<2" }, - { name = "youdotcom", specifier = ">=3.0.0,<4" }, + { name = "youdotcom", specifier = ">=3.1.2,<4" }, ] [package.metadata.requires-dev]