Support Python 3.10 and PyPy 3.10
Marco Ricci

Marco Ricci commited on 2024-07-14 11:51:22
Zeige 11 geänderte Dateien mit 23 Einfügungen und 30 Löschungen.


This mostly involves relying on `typing_extensions` instead of `typing`.

Since we're at it, also clean up unused module or symbol imports.
... ...
@@ -7,7 +7,7 @@ name = "derivepassphrase"
7 7
 dynamic = ["version"]
8 8
 description = "An almost faithful Python reimplementation of James Coglan's vault."
9 9
 readme = "README.md"
10
-requires-python = ">=3.11"
10
+requires-python = ">=3.10"
11 11
 license = "MIT"
12 12
 keywords = []
13 13
 authors = [
... ...
@@ -18,6 +18,7 @@ classifiers = [
18 18
   "Environment :: Console",
19 19
   "License :: OSI Approved :: MIT License",
20 20
   "Programming Language :: Python :: 3",
21
+  "Programming Language :: Python :: 3.10",
21 22
   "Programming Language :: Python :: 3.11",
22 23
   "Programming Language :: Python :: 3.12",
23 24
   "Programming Language :: Python :: Implementation :: CPython",
... ...
@@ -25,14 +26,12 @@ classifiers = [
25 26
 ]
26 27
 dependencies = [
27 28
   "click>=8.1",
29
+  "typing_extensions",
28 30
 ]
29 31
 
30 32
 [project.optional-dependencies]
31
-dev = [
32
-  "mkdocs",
33
-  "mkdocstrings[python]",
34
-  "pytest",
35
-]
33
+dev = ["black", "coverage", "hatch>=1.10", "mkdocs", "mkdocs-material",
34
+       "mkdocstrings[python]", "pytest>=8.1"]
36 35
 
37 36
 [project.urls]
38 37
 Documentation = "https://github.com/the-13th-letter/derivepassphrase#readme"
... ...
@@ -62,7 +61,7 @@ path = "src/derivepassphrase/__init__.py"
62 61
 default-args = ['src', 'tests']
63 62
 
64 63
 [[tool.hatch.envs.hatch-test.matrix]]
65
-python = ["3.11", "3.12"]
64
+python = ["3.10", "3.11", "3.12", "pypy3.10"]
66 65
 
67 66
 [tool.hatch.envs.hatch-test.scripts]
68 67
 run = "pytest{env:HATCH_TEST_ARGS:} {args}"
... ...
@@ -13,9 +13,8 @@ import collections
13 13
 import hashlib
14 14
 import math
15 15
 import unicodedata
16
-import warnings
17 16
 
18
-from typing import assert_type, reveal_type
17
+from typing_extensions import assert_type
19 18
 
20 19
 import sequin
21 20
 import ssh_agent_client
... ...
@@ -10,16 +10,14 @@ from __future__ import annotations
10 10
 
11 11
 import base64
12 12
 import collections
13
-from collections.abc import MutableMapping
14 13
 import contextlib
15 14
 import inspect
16 15
 import json
17 16
 import os
18 17
 import pathlib
19 18
 import socket
20
-from typing import (
21
-    Any, assert_never, cast, reveal_type, Iterator, Never, NotRequired,
22
-    Sequence, TextIO, TypedDict, TYPE_CHECKING,
19
+from typing_extensions import (
20
+    Any, assert_never, cast, Iterator, Sequence, TextIO,
23 21
 )
24 22
 
25 23
 import click
... ...
@@ -8,7 +8,9 @@
8 8
 
9 9
 from __future__ import annotations
10 10
 
11
-from typing import Any, NotRequired, Required, TypedDict, TypeGuard
11
+from typing_extensions import (
12
+    Any, NotRequired, Required, TypedDict, TypeGuard,
13
+)
12 14
 
13 15
 import derivepassphrase
14 16
 
... ...
@@ -22,10 +22,9 @@ thoroughly documented.
22 22
 from __future__ import annotations
23 23
 
24 24
 import collections
25
-import math
26 25
 
27
-from collections.abc import Iterator, MutableSequence, Sequence
28
-from typing import assert_type, Literal, TypeAlias
26
+from collections.abc import Iterator, Sequence
27
+from typing_extensions import assert_type
29 28
 
30 29
 __all__ = ('Sequin', 'SequinExhaustedError')
31 30
 __author__ = 'Marco Ricci <m@the13thletter.info>'
... ...
@@ -7,14 +7,13 @@
7 7
 from __future__ import annotations
8 8
 
9 9
 import collections
10
-import enum
11 10
 import errno
12 11
 import os
13
-import pathlib
14 12
 import socket
15 13
 
16
-from collections.abc import Sequence, MutableSequence
17
-from typing import Any, NamedTuple, Self, TypeAlias
14
+from collections.abc import Sequence
15
+from typing_extensions import Any, Self
16
+
18 17
 from ssh_agent_client import types
19 18
 
20 19
 __all__ = ('SSHAgentClient',)
... ...
@@ -9,15 +9,16 @@ from collections.abc import Iterator, Mapping
9 9
 import contextlib
10 10
 import json
11 11
 import os
12
-from typing import Any, TYPE_CHECKING, TypedDict
12
+from typing import TYPE_CHECKING
13
+from typing_extensions import Any, TypedDict
13 14
 
14 15
 import click.testing
15 16
 import derivepassphrase
16 17
 import derivepassphrase.cli
17 18
 import derivepassphrase.types
19
+import pytest
18 20
 import ssh_agent_client
19 21
 import ssh_agent_client.types
20
-import pytest
21 22
 
22 23
 __all__ = ()
23 24
 
... ...
@@ -10,9 +10,7 @@ import math
10 10
 from typing import Any
11 11
 
12 12
 import derivepassphrase
13
-import sequin
14 13
 import pytest
15
-import tests
16 14
 
17 15
 Vault = derivepassphrase.Vault
18 16
 
... ...
@@ -4,12 +4,11 @@
4 4
 
5 5
 from __future__ import annotations
6 6
 
7
-import base64
8 7
 from collections.abc import Callable
9 8
 import json
10 9
 import os
11 10
 import socket
12
-from typing import Any, cast, TYPE_CHECKING, NamedTuple
11
+from typing_extensions import Any, cast, NamedTuple
13 12
 
14 13
 import click.testing
15 14
 import derivepassphrase as dpp
... ...
@@ -4,7 +4,7 @@
4 4
 
5 5
 from __future__ import annotations
6 6
 
7
-from typing import Any, cast, TYPE_CHECKING, NamedTuple
7
+from typing_extensions import Any
8 8
 
9 9
 import derivepassphrase.types
10 10
 import pytest
... ...
@@ -7,12 +7,11 @@
7 7
 from __future__ import annotations
8 8
 
9 9
 import base64
10
-import errno
11 10
 import io
12 11
 import os
13 12
 import socket
14 13
 import subprocess
15
-from typing import Any
14
+from typing_extensions import Any
16 15
 
17 16
 import click
18 17
 import click.testing
19 18