Skip to content
Draft
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
13 changes: 2 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
Expand All @@ -28,15 +28,6 @@ jobs:
- name: Install dependencies
run: uv sync --locked --dev

- name: Check formatting
run: uv run ruff format --check .

- name: Lint
run: uv run ruff check --extend-exclude .devbox

- name: Type Check
run: uv run mypy

- name: Test
run: uv run pytest

Expand All @@ -47,7 +38,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Lint

on:
push:
branches:
- "main"
pull_request: {}

defaults:
run:
shell: bash

jobs:
lint:
name: Python lint and typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: "3.14"
enable-cache: true

- name: Install dependencies
run: uv sync --locked --dev
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Lint workflow installs all dev dependencies unnecessarily

uv sync --locked --dev installs every dependency group (test, nox, type_check, and lint), but this job only needs lint and type_check. Consider restricting the install to keep the job lean:

Suggested change
run: uv sync --locked --dev
run: uv sync --locked --only-group lint --only-group type_check


- name: Check formatting
run: uv run ruff format --check .

- name: Lint
run: uv run ruff check --extend-exclude .devbox

- name: Type check
run: uv run mypy
3 changes: 1 addition & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ uv run mypy # Type checking

### Testing

The SDK uses [nox](https://nox.thea.codes/) with [nox-uv](https://github.com/dantebben/nox-uv) for multi-version Python testing. This ensures compatibility across all supported Python versions (3.8-3.14).
The SDK uses [nox](https://nox.thea.codes/) with [nox-uv](https://github.com/dantebben/nox-uv) for multi-version Python testing. This ensures compatibility across all supported Python versions (3.10-3.14).

**Quick testing with the test script:**

Expand Down Expand Up @@ -116,4 +116,3 @@ When adding new features:
2. Add Pydantic models in appropriate `types/` subdirectory
3. Implement comprehensive tests using the sync_and_async marker
4. Follow existing patterns for pagination, error handling, and type annotations

8 changes: 4 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
nox.options.reuse_venv = "yes"

# All Python versions supported by the SDK (must match CI matrix)
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13", "3.14"]

# Default sessions to run
nox.options.sessions = ["tests"]
Expand Down Expand Up @@ -56,8 +56,8 @@ def format_fix(s: nox.Session) -> None:

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


@session(uv_groups=["test", "lint", "type_check"])
Expand All @@ -68,5 +68,5 @@ def ci(s: nox.Session) -> None:
"""
s.run("ruff", "format", "--check", ".")
s.run("ruff", "check", ".")
s.run("mypy")
s.run("pyright")
s.run("pytest")
19 changes: 5 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ description = "WorkOS Python Client"
readme = "README.md"
license = "MIT"
authors = [{ name = "WorkOS", email = "team@workos.com" }]
requires-python = ">=3.8"
requires-python = ">=3.10"

dependencies = [
"cryptography>=44.0.2",
"httpx~=0.28.1",
"pydantic>=2.10.4",
"pyjwt>=2.12.0 ; python_full_version >= '3.9'",
"pyjwt>=2.9.0,<2.10 ; python_full_version == '3.8.*'",
"pyjwt>=2.12.0",
]

[project.urls]
Expand All @@ -27,18 +26,10 @@ dev = [
{ include-group = "type_check" },
{ include-group = "nox" },
]
test = [
"pytest==8.3.4",
"pytest-asyncio==0.23.8",
"pytest-cov==5.0.0",
"six==1.17.0",
]
test = ["pytest~=8.3", "pytest-asyncio~=1.3", "pytest-cov~=7.0"]
lint = ["ruff==0.14.5"]
type_check = ["mypy==1.14.1"]
nox = [
"nox>=2024.10.9 ; python_version >= '3.9'",
"nox-uv>=0.7.0 ; python_version >= '3.9'",
]
type_check = ["pyright~=1.1"]
nox = ["nox~=2026.2", "nox-uv~=0.7"]


[tool.mypy]
Expand Down
28 changes: 16 additions & 12 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ def test_authenticate_success(self, session_constants, mock_user_management):
"feature_flags": ["flag1", "flag2"],
}

with patch.object(Session, "unseal_data", return_value=mock_session), patch(
"jwt.decode", return_value=mock_jwt_payload
), patch.object(
session.jwks,
"get_signing_key_from_jwt",
return_value=Mock(key=session_constants["PUBLIC_KEY"]),
with (
patch.object(Session, "unseal_data", return_value=mock_session),
patch("jwt.decode", return_value=mock_jwt_payload),
patch.object(
session.jwks,
"get_signing_key_from_jwt",
return_value=Mock(key=session_constants["PUBLIC_KEY"]),
),
):
response = session.authenticate()

Expand Down Expand Up @@ -319,12 +321,14 @@ def test_authenticate_success_with_roles(
"feature_flags": ["flag1", "flag2"],
}

with patch.object(Session, "unseal_data", return_value=mock_session), patch(
"jwt.decode", return_value=mock_jwt_payload
), patch.object(
session.jwks,
"get_signing_key_from_jwt",
return_value=Mock(key=session_constants["PUBLIC_KEY"]),
with (
patch.object(Session, "unseal_data", return_value=mock_session),
patch("jwt.decode", return_value=mock_jwt_payload),
patch.object(
session.jwks,
"get_signing_key_from_jwt",
return_value=Mock(key=session_constants["PUBLIC_KEY"]),
),
):
response = session.authenticate()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_sso.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from typing import Union
from six.moves.urllib.parse import parse_qsl, urlparse
from urllib.parse import parse_qsl, urlparse
import pytest
from tests.types.test_auto_pagination_function import TestAutoPaginationFunction
from tests.utils.fixtures.mock_profile import MockProfile
Expand Down
2 changes: 1 addition & 1 deletion tests/test_user_management.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import Union

from six.moves.urllib.parse import parse_qsl, urlparse
from urllib.parse import parse_qsl, urlparse
import pytest

from tests.utils.fixtures.mock_auth_factor_totp import MockAuthenticationFactorTotp
Expand Down
Loading
Loading