Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<package 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/<version>; ua=python/<v> httpx/<v>`; the SDK's own `user-agent` stays as `youdotcom-python-sdk/<v>`. The `_USER_AGENT` constant is removed

## [1.0.1] — 2026-08-18

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 8 additions & 2 deletions src/youdotcom_temporal/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<v>``; the plugin identity rides
# the attribution header instead.
_APP_NAME = "youdotcom-temporal"
_APP_VERSION = __version__


@asynccontextmanager
Expand All @@ -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
19 changes: 7 additions & 12 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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():
Expand All @@ -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"
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading