Skip to content

Commit

Permalink
Deprecate Python 3.7 (#165)
Browse files Browse the repository at this point in the history
* deprecate python 3.7

* add types
  • Loading branch information
bmw authored Jul 10, 2023
1 parent 49bd49c commit 79acf2f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changelog
---------------

* Added support for Python 3.11.
* Support for Python 3.7 has been deprecated and will be removed in the next
scheduled release.
* Dropped support for Python 3.6.
* Added a new valid PGP key for signing our PyPI packages with the fingerprint
F2871B4152AE13C49519111F447BF683AA3B26C3
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Security",
]
homepage = "https://github.com/certbot/josepy"
Expand Down Expand Up @@ -94,7 +94,8 @@ disallow_untyped_defs = true
# Pytest tooling configuration

[tool.pytest.ini_options]
filterwarnings = ["error"]
# We also ignore our own deprecation warning about dropping Python 3.7 support.
filterwarnings = ["error", "ignore:Python 3.7 support will be dropped:DeprecationWarning"]
norecursedirs = "*.egg .eggs dist build docs .tox"

# Isort tooling configuration
Expand Down
10 changes: 10 additions & 0 deletions src/josepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
.. _ACME: https://pypi.python.org/pypi/acme
"""
import sys
import warnings

# flake8: noqa
from josepy.b64 import b64decode, b64encode
from josepy.errors import (
Expand Down Expand Up @@ -72,3 +75,10 @@
ComparableX509,
ImmutableMap,
)

if sys.version_info[:2] == (3, 7):
warnings.warn(
"Python 3.7 support will be dropped in the next scheduled release of "
"josepy. Please upgrade your Python version.",
DeprecationWarning,
)
25 changes: 25 additions & 0 deletions tests/init_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import importlib
import re
import sys
import warnings

import pytest

import josepy


@pytest.mark.skipif(sys.version_info[:2] != (3, 7), reason="requires Python 3.7")
def test_warns() -> None:
with pytest.warns(DeprecationWarning, match=re.escape(r"Python 3.7 support")):
importlib.reload(josepy)


@pytest.mark.skipif(sys.version_info[:2] == (3, 7), reason="requires Python != 3.7")
def test_does_not_warn() -> None:
with warnings.catch_warnings():
warnings.simplefilter("error")
importlib.reload(josepy)


if __name__ == "__main__":
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

0 comments on commit 79acf2f

Please sign in to comment.