Skip to content

Commit c8ed377

Browse files
gjtorikianclaude
andcommitted
fix: make typing_extensions a conditional runtime dep for Py 3.10
`src/workos/_types.py` imports `Self`, which landed in stdlib `typing` only in Python 3.11. Use a `sys.version_info` conditional so 3.11+ uses stdlib and 3.10 falls back to `typing_extensions`, matching the SDK's `requires-python = '>=3.10'`. Mark `typing_extensions~=4.0` as `python_version < '3.11'` in the dependency list so pip/uv only install it on 3.10 — 3.11+ users don't pay the transitive-dep cost. Drop the now-unconditional typing_extensions check from the smoke test (the conditional import is exercised whenever workos itself is imported). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7ab455f commit c8ed377

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies = [
1111
"cryptography~=46.0",
1212
"httpx~=0.28",
1313
"pyjwt~=2.12",
14-
"typing_extensions~=4.0",
14+
"typing_extensions~=4.0; python_version < '3.11'",
1515
]
1616

1717
[project.urls]

src/workos/_types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import sys
66
from datetime import datetime
77
from enum import Enum
8-
from typing import Any, Dict, NoReturn, Protocol, TypeVar
9-
from typing_extensions import Self, TypedDict
8+
from typing import Any, Dict, NoReturn, Protocol, TypedDict, TypeVar
9+
10+
if sys.version_info >= (3, 11):
11+
from typing import Self
12+
else:
13+
from typing_extensions import Self
1014

1115

1216
class RequestOptions(TypedDict, total=False):

tests/smoke_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,8 @@ def test_dependencies_available() -> None:
205205
import cryptography
206206
import httpx
207207
import jwt
208-
import typing_extensions
209208

210-
print(
211-
"✓ Core dependencies available (httpx, cryptography, pyjwt, typing_extensions)"
212-
)
209+
print("✓ Core dependencies available (httpx, cryptography, pyjwt)")
213210

214211

215212
def main() -> int:

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)