Skip to content

Commit a4e1a3d

Browse files
jpadillaclaudepre-commit-ci[bot]
authored
Add typing_extensions dependency for Python < 3.11 (#1151)
* Add typing_extensions as dependency for Python < 3.11 PyJWT imports typing_extensions.Never (Python < 3.11) and typing_extensions.TypeAlias (Python < 3.10) at runtime in jwt/algorithms.py, but typing_extensions was never declared as a dependency. This causes a ModuleNotFoundError on Python 3.9/3.10 when importing the library. Fixes #1150 https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add minimal install CI job to catch undeclared dependencies The existing install-dev job always installs with [dev] extras, which bundles cryptography and pulls in typing_extensions transitively via test tooling. This masked the missing typing_extensions dependency (#1150). Add an install-minimal job that tests bare `pip install .` and `pip install .[crypto]` on Python 3.9 and 3.13, ensuring undeclared runtime dependencies are caught immediately. https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F * Merge install-minimal into install-dev and test all install modes Consolidate into a single job that tests progressively: bare install, crypto extra, then dev extras. Tests Python 3.9 and 3.13 to cover both the typing_extensions fallback and native typing paths. https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F * Bump version to 2.12.1 https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F * Add explicit permissions block to CI workflow Restrict GITHUB_TOKEN to read-only contents access, as flagged by github-advanced-security[bot]. https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F * Fix RST underline length in CHANGELOG https://claude.ai/code/session_013ZvbKEyVkcUx8xHrqt8v2F --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bd9700c commit a4e1a3d

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

.github/workflows/main.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches: ["master"]
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
tests:
1316
name: "Python ${{ matrix.python-version }} on ${{ matrix.platform }}"
@@ -97,19 +100,32 @@ jobs:
97100
strategy:
98101
matrix:
99102
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
103+
python-version: ["3.9", "3.13"]
100104

101-
name: "Verify dev env"
105+
name: "Verify dev env (Python ${{ matrix.python-version }}, ${{ matrix.os }})"
102106
runs-on: "${{ matrix.os }}"
103107

104108
steps:
105109
- uses: "actions/checkout@v6"
106110
- uses: "actions/setup-python@v6"
107111

108112
with:
109-
python-version: "3.9"
113+
python-version: "${{ matrix.python-version }}"
114+
115+
- name: "Install with no extras"
116+
run: "python -m pip install ."
117+
118+
- name: "Import package"
119+
run: "python -c 'import jwt; print(jwt.__version__)'"
120+
121+
- name: "Install with crypto extra"
122+
run: "python -m pip install .[crypto]"
123+
124+
- name: "Import package with crypto"
125+
run: "python -c 'import jwt; print(jwt.__version__)'"
110126

111127
- name: "Install in dev mode"
112128
run: "python -m pip install -e .[dev]"
113129

114-
- name: "Import package"
130+
- name: "Import package in dev mode"
115131
run: "python -c 'import jwt; print(jwt.__version__)'"

CHANGELOG.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ Changelog
44
All notable changes to this project will be documented in this file.
55
This project adheres to `Semantic Versioning <https://semver.org/>`__.
66

7-
`Unreleased <https://github.com/jpadilla/pyjwt/compare/2.11.0...HEAD>`__
7+
`Unreleased <https://github.com/jpadilla/pyjwt/compare/2.12.1...HEAD>`__
88
------------------------------------------------------------------------
99

10+
`v2.12.1 <https://github.com/jpadilla/pyjwt/compare/2.12.0...2.12.1>`__
11+
------------------------------------------------------------------------
12+
13+
Fixed
14+
~~~~~
15+
16+
- Add missing ``typing_extensions`` dependency for Python < 3.11 in `#1150 <https://github.com/jpadilla/pyjwt/issues/1150>`__
17+
1018
`v2.12.0 <https://github.com/jpadilla/pyjwt/compare/2.11.0...2.12.0>`__
1119
-----------------------------------------------------------------------
1220

jwt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from .jwks_client import PyJWKClient
2929
from .warnings import InsecureKeyLengthWarning
3030

31-
__version__ = "2.12.0"
31+
__version__ = "2.12.1"
3232

3333
__title__ = "PyJWT"
3434
__description__ = "JSON Web Token implementation in Python"

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ classifiers = [
2323
"Programming Language :: Python :: 3.14",
2424
"Topic :: Utilities",
2525
]
26+
dependencies = [
27+
"typing_extensions >= 4.0; python_version < '3.11'",
28+
]
2629
description = "JSON Web Token implementation in Python"
2730
dynamic = [
2831
"version",

0 commit comments

Comments
 (0)