Skip to content

Commit

Permalink
deprecate py38 support (certbot#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmw authored and jvanasco committed Jan 8, 2025
1 parent 927bcfe commit 5bbd0b3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changelog
---------------
* Added support for Python 3.13.
* Dropped support for Python 3.7.
* Support for Python 3.8 has been deprecated and will be removed in the next
scheduled release.
* Deprecated pyOpenSSL in favor of Cryptography and removed the required
dependency. The underlying storage format of the `josepy.util.ComparableX509`
has been switched to `cryptography.x509` objects, and the
Expand All @@ -21,7 +23,6 @@ Changelog
`23.2.0`, projects migrating to the new backend may experience a version
conflict during the code transition.


1.14.0 (2023-11-01)
-------------------

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ disallow_untyped_defs = true
filterwarnings = [
"error",
"ignore:CSR support in pyOpenSSL is deprecated:DeprecationWarning",
# We ignore our own warning about dropping Python 3.8 support.
"ignore:Python 3.8 support will be dropped:DeprecationWarning",
]
norecursedirs = "*.egg .eggs dist build docs .tox"

Expand Down
10 changes: 10 additions & 0 deletions src/josepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"""

import sys
import warnings

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

if sys.version_info[:2] == (3, 8):
warnings.warn(
"Python 3.8 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, 8), reason="requires Python 3.8")
def test_warns() -> None:
with pytest.warns(DeprecationWarning, match=re.escape(r"Python 3.8 support")):
importlib.reload(josepy)


@pytest.mark.skipif(sys.version_info[:2] == (3, 8), reason="requires Python != 3.8")
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 5bbd0b3

Please sign in to comment.