Skip to content

Commit

Permalink
Drop Python 3.7 support
Browse files Browse the repository at this point in the history
3.7 is EOL, and while the core library could still continue to support
3.7, aiohttp has dropped it already. I don't feel like complicating
the test setup in favour of maintaining backwards compat with 3.7.

Dropping 3.7 also allows removing some compatibility hacks that are no
longer necessary.
  • Loading branch information
MatthiasValvekens committed Nov 19, 2023
1 parent 938bdee commit 05b2fa4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
needs: build
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ or ask on the discussion forum.

### General policy

Currently, pyHanko aims to remain compatible with Python versions 3.7 and up,
Currently, pyHanko aims to remain compatible with Python versions 3.8 and up,
and this is expected of new contributions as well (for the time being).

PyHanko follows [SemVer](https://semver.org/), but has not yet reached `1.0.0`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pip install pyHanko[pkcs11,image-support,opentype,xmp]
This `pip` invocation includes the optional dependencies required for PKCS#11, image handling and
OpenType/TrueType support.

PyHanko requires Python 3.7 or later.
PyHanko requires Python 3.8 or later.

### Contributing

Expand Down
14 changes: 0 additions & 14 deletions pyhanko/cli/_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@ def _root(ctx: click.Context, config, verbose, no_plugins):

def _load_plugins(root_config: Optional[CLIRootConfig], plugins_enabled: bool):
import sys

if sys.version_info < (3, 8):
from pyhanko.cli.commands.signing.pkcs11_cli import (
BEIDPlugin,
PKCS11Plugin,
)
from pyhanko.cli.commands.signing.simple import (
PemderPlugin,
PKCS12Plugin,
)

# no plugins on 3.7, only load defaults
return [PemderPlugin(), PKCS12Plugin(), PKCS11Plugin(), BEIDPlugin()]

from importlib import metadata

# we always load the default ones
Expand Down
18 changes: 2 additions & 16 deletions pyhanko/config/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dataclasses
import re
from typing import Any, Optional, Set, Tuple, Type, Union
from typing import Optional, Set, Type, Union

from asn1crypto.core import BitString, ObjectIdentifier

Expand All @@ -31,21 +31,7 @@ def _unwrap_type_annot(thing) -> Optional[type]:
if isinstance(thing, type):
the_type = thing
else:
try:
from typing import get_args, get_origin
except ImportError: # pragma: nocover
# backwards compatibility with Python 3.7
def get_args(tp: Any) -> Tuple[Any, ...]:
try:
return tp.__args__
except AttributeError:
return ()

def get_origin(tp: Any) -> Optional[Any]:
try:
return tp.__origin__
except AttributeError:
return None
from typing import get_args, get_origin

# is it an optional? (i.e. Union[X, None])
# if so, retrieve the wrapped type
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ classifiers = [
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -33,7 +32,7 @@ classifiers = [
"Topic :: Security :: Cryptography",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"asn1crypto>=1.5.1",
"qrcode>=7.3.1",
Expand Down

0 comments on commit 05b2fa4

Please sign in to comment.