Skip to content

Commit 6033b93

Browse files
gjtorikianclaude
andcommitted
chore: switch type checker from mypy to pyright strict
Replace mypy with pyright as the primary type checker. pyright is faster, catches more real bugs (better type narrowing, generic inference, union handling), and is the industry standard for production Python SDKs (used by OpenAI, Anthropic, Stripe). - Replace mypy with pyright in noxfile.py (typecheck + ci sessions) - Swap mypy for pyright in type_check dependency group - Remove [tool.mypy] config section - Add [tool.pyright] with typeCheckingMode = "strict" - Update uv.lock The generated SDK passes pyright strict with 0 errors across 374 files. This also addresses #600 (SsoProviderType enum removal) — the emitter generates all spec enums as str/Enum classes, restoring attribute access (e.g., EnumName.VALUE) that was lost when v5 switched to Literal type aliases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e24084e commit 6033b93

File tree

3 files changed

+30
-62
lines changed

3 files changed

+30
-62
lines changed

noxfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def format_fix(s: nox.Session) -> None:
5656

5757
@session(uv_groups=["type_check"])
5858
def typecheck(s: nox.Session) -> None:
59-
"""Run type checking with mypy."""
60-
s.run("mypy")
59+
"""Run type checking with pyright."""
60+
s.run("pyright")
6161

6262

6363
@session(uv_groups=["test", "lint", "type_check"])
@@ -68,5 +68,5 @@ def ci(s: nox.Session) -> None:
6868
"""
6969
s.run("ruff", "format", "--check", ".")
7070
s.run("ruff", "check", ".")
71-
s.run("mypy")
71+
s.run("pyright")
7272
s.run("pytest")

pyproject.toml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dev = [
2525
{ include-group = "lint" },
2626
{ include-group = "type_check" },
2727
{ include-group = "nox" },
28+
"pyright>=1.1.408",
2829
]
2930
test = [
3031
"pytest==8.3.4",
@@ -33,25 +34,13 @@ test = [
3334
"six==1.17.0",
3435
]
3536
lint = ["ruff==0.14.5"]
36-
type_check = ["mypy==1.14.1"]
37+
type_check = ["pyright>=1.1.408"]
3738
nox = [
3839
"nox>=2024.10.9",
3940
"nox-uv>=0.7.0",
4041
]
4142

4243

43-
[tool.mypy]
44-
packages = "workos"
45-
warn_return_any = true
46-
warn_unused_configs = true
47-
warn_unreachable = true
48-
warn_redundant_casts = true
49-
warn_no_return = true
50-
warn_unused_ignores = true
51-
implicit_reexport = true
52-
strict_equality = true
53-
strict = true
54-
5544
[tool.ruff.lint.per-file-ignores]
5645
"*/__init__.py" = ["F401", "F403"]
5746

@@ -62,6 +51,10 @@ max-complexity = 10
6251
source-include = ["py.typed"]
6352
source-exclude = ["tests*"]
6453

54+
[tool.pyright]
55+
typeCheckingMode = "strict"
56+
include = ["workos"]
57+
6558
[build-system]
6659
requires = ["uv_build>=0.8.15,<0.9.0"]
6760
build-backend = "uv_build"

uv.lock

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

0 commit comments

Comments
 (0)