Skip to content

Commit 73dd577

Browse files
authored
Merge pull request #1069 from jku/deprecate-python-3.9
Bump minimum required Python to 3.10
2 parents 28046c2 + 037f4ea commit 73dd577

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

.github/workflows/_test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
# Run tests once on each supported Python
13-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
13+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1414
os: [ubuntu-latest]
1515
toxenv: [py]
1616
include:
17-
# Run macOS tests on 3.9 (current OS X python) and latest,
17+
# Run macOS tests on 3.10 (current OS X python) and latest,
1818
# Run Windows and "special" tests on latest Python version only
1919
# Run linter on oldest supported Python
20-
- python-version: "3.9"
20+
- python-version: "3.10"
2121
os: macos-latest
2222
toxenv: py
2323
- python-version: "3.13"
@@ -35,7 +35,7 @@ jobs:
3535
- python-version: "3.13"
3636
os: ubuntu-latest
3737
toxenv: py-test-gpg-fails
38-
- python-version: "3.9"
38+
- python-version: "3.10"
3939
os: ubuntu-latest
4040
toxenv: lint
4141

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ classifiers = [
2626
"Operating System :: MacOS :: MacOS X",
2727
"Operating System :: Microsoft :: Windows",
2828
"Programming Language :: Python :: 3",
29-
"Programming Language :: Python :: 3.9",
3029
"Programming Language :: Python :: 3.10",
3130
"Programming Language :: Python :: 3.11",
3231
"Programming Language :: Python :: 3.12",
3332
"Programming Language :: Python :: 3.13",
33+
"Programming Language :: Python :: 3.14",
3434
"Programming Language :: Python :: Implementation :: CPython",
3535
"Topic :: Security",
3636
"Topic :: Software Development",
3737
]
38-
requires-python = "~=3.8"
38+
requires-python = "~=3.10"
3939
dynamic = ["version"]
4040

4141
[project.urls]

securesystemslib/formats.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
"""
2222

23-
from typing import Callable, Optional, Union
23+
from collections.abc import Callable
2424

2525
from securesystemslib import exceptions
2626

@@ -52,7 +52,7 @@ def _canonical_string_encoder(string: str) -> str:
5252

5353

5454
def _encode_canonical(
55-
object: Union[bool, None, str, int, tuple, list, dict], output_function: Callable
55+
object: bool | None | str | int | tuple | list | dict, output_function: Callable
5656
) -> None:
5757
# Helper for encode_canonical. Older versions of json.encoder don't
5858
# even let us replace the separators.
@@ -94,9 +94,9 @@ def _encode_canonical(
9494

9595

9696
def encode_canonical(
97-
object: Union[bool, None, str, int, tuple, list, dict],
98-
output_function: Optional[Callable] = None,
99-
) -> Union[str, None]:
97+
object: bool | None | str | int | tuple | list | dict,
98+
output_function: Callable | None = None,
99+
) -> str | None:
100100
"""
101101
<Purpose>
102102
Encoding an object so that it is always has the same string format
@@ -150,7 +150,7 @@ def encode_canonical(
150150
A string representing the 'object' encoded in canonical JSON form.
151151
"""
152152

153-
result: Union[None, list] = None
153+
result: None | list = None
154154
# If 'output_function' is unset, treat it as
155155
# appending to a list.
156156
if output_function is None:

securesystemslib/signer/_crypto_signer.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import os
55
from dataclasses import astuple, dataclass
6-
from typing import Optional, Union
76
from urllib import parse
87

98
from securesystemslib.exceptions import UnsupportedLibraryError
@@ -116,7 +115,7 @@ class CryptoSigner(Signer):
116115
def __init__(
117116
self,
118117
private_key: "PrivateKeyTypes",
119-
public_key: Optional[SSlibKey] = None,
118+
public_key: SSlibKey | None = None,
120119
):
121120
if CRYPTO_IMPORT_ERROR:
122121
raise UnsupportedLibraryError(CRYPTO_IMPORT_ERROR)
@@ -125,7 +124,7 @@ def __init__(
125124
public_key = SSlibKey.from_crypto(private_key.public_key())
126125

127126
self._private_key: PrivateKeyTypes
128-
self._sign_args: Union[_RSASignArgs, _ECDSASignArgs, _NoSignArgs]
127+
self._sign_args: _RSASignArgs | _ECDSASignArgs | _NoSignArgs
129128

130129
if public_key.keytype == "rsa" and public_key.scheme in [
131130
"rsassa-pss-sha224",
@@ -195,7 +194,7 @@ def from_priv_key_uri(
195194
cls,
196195
priv_key_uri: str,
197196
public_key: Key,
198-
secrets_handler: Optional[SecretsHandler] = None,
197+
secrets_handler: SecretsHandler | None = None,
199198
) -> "CryptoSigner":
200199
"""Constructor for Signer to call
201200
@@ -248,7 +247,7 @@ def from_priv_key_uri(
248247

249248
@staticmethod
250249
def generate_ed25519(
251-
keyid: Optional[str] = None,
250+
keyid: str | None = None,
252251
) -> "CryptoSigner":
253252
"""Generate new key pair as "ed25519" signer.
254253
@@ -270,8 +269,8 @@ def generate_ed25519(
270269

271270
@staticmethod
272271
def generate_rsa(
273-
keyid: Optional[str] = None,
274-
scheme: Optional[str] = "rsassa-pss-sha256",
272+
keyid: str | None = None,
273+
scheme: str | None = "rsassa-pss-sha256",
275274
size: int = 3072,
276275
) -> "CryptoSigner":
277276
"""Generate new key pair as rsa signer.
@@ -299,7 +298,7 @@ def generate_rsa(
299298

300299
@staticmethod
301300
def generate_ecdsa(
302-
keyid: Optional[str] = None,
301+
keyid: str | None = None,
303302
) -> "CryptoSigner":
304303
"""Generate new key pair as "ecdsa-sha2-nistp256" signer.
305304

securesystemslib/signer/_signer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import logging
66
from abc import ABCMeta, abstractmethod
7-
from typing import Callable
7+
from collections.abc import Callable
88

99
from securesystemslib.signer._key import Key
1010
from securesystemslib.signer._signature import Signature

tests/test_signer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import unittest
88
from contextlib import suppress
99
from pathlib import Path
10-
from typing import Any, Optional
10+
from typing import Any
1111

1212
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
1313
from cryptography.hazmat.primitives.serialization import (
@@ -760,7 +760,7 @@ def from_priv_key_uri(
760760
cls,
761761
priv_key_uri: str,
762762
public_key: Key,
763-
secrets_handler: Optional[SecretsHandler] = None,
763+
secrets_handler: SecretsHandler | None = None,
764764
) -> "CustomSigner":
765765
return cls(key)
766766

0 commit comments

Comments
 (0)