Skip to content

Commit 75bbdfb

Browse files
authored
deprecate python 3.9 support (#240)
1 parent 7fb3940 commit 75bbdfb

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Changelog
44
2.2.0 (main)
55
------------
66

7+
* Support for Python 3.9 has been deprecated and will be removed in the next
8+
scheduled release.
9+
710
2.1.0 (2025-07-08)
811
------------
912

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ disallow_untyped_defs = true
9696
[tool.pytest.ini_options]
9797
filterwarnings = [
9898
"error",
99+
# We ignore our own warning about dropping Python 3.9 support.
100+
"ignore:Python 3.9 support will be dropped:DeprecationWarning",
99101
]
100102
norecursedirs = "*.egg .eggs dist build docs .tox"
101103

src/josepy/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
2727
"""
2828

29+
import sys
30+
import warnings
31+
2932
# flake8: noqa
3033
from josepy.b64 import b64decode, b64encode
3134
from josepy.errors import (
@@ -72,3 +75,10 @@
7275
ComparableRSAKey,
7376
ImmutableMap,
7477
)
78+
79+
if sys.version_info[:2] == (3, 9):
80+
warnings.warn(
81+
"Python 3.9 support will be dropped in the next scheduled release of "
82+
"josepy. Please upgrade your Python version.",
83+
DeprecationWarning,
84+
)

tests/init_tests.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import importlib
2+
import re
3+
import sys
4+
import warnings
5+
6+
import pytest
7+
8+
import josepy
9+
10+
11+
@pytest.mark.skipif(sys.version_info[:2] != (3, 9), reason="requires Python 3.9")
12+
def test_warns() -> None:
13+
with pytest.warns(DeprecationWarning, match=re.escape(r"Python 3.9 support")):
14+
importlib.reload(josepy)
15+
16+
17+
@pytest.mark.skipif(sys.version_info[:2] == (3, 9), reason="requires Python != 3.9")
18+
def test_does_not_warn() -> None:
19+
with warnings.catch_warnings():
20+
warnings.simplefilter("error")
21+
importlib.reload(josepy)
22+
23+
24+
if __name__ == "__main__":
25+
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

0 commit comments

Comments
 (0)