Pin testing dependencies
Marco Ricci

Marco Ricci commited on 2025-06-09 20:34:03
Zeige 1 geänderte Dateien mit 20 Einfügungen und 0 Löschungen.


Pin the versions of testing dependencies to ensure easy installability.
Specifically, pin `cryptography` on PyPy to versions that support
wheels, and pin `hypothesis` on Python 3.9 (CPython and PyPy) to
versions that correctly support the old LL(1) parser. Because
`cryptography` is an optional dependency, we introduce a new, matching
extra for the `cryptography` version pins, with an appropriate name.

As the extras are getting a bit confusing, especially with regard to one
another, we add a one-line synopsis to the beginning of each extra's
commentary.
... ...
@@ -42,6 +42,8 @@ dependencies = [
42 42
 
43 43
 [project.optional-dependencies]
44 44
 dev = [
45
+    # dev - developers' setup
46
+    #
45 47
     # Development uses the hatch build system, to isolate all tools in
46 48
     # their own virtual environment...
47 49
     "hatch >= 1.10",
... ...
@@ -60,8 +62,13 @@ dev = [
60 62
     "pytest >= 8.1",
61 63
     "pytest-randomly >= 3.15",
62 64
     "pytest-xdist[psutil] >= 3.6.0",
65
+    # Versions 6.130.13 through 6.135.1 of `hypothesis` use syntax only
66
+    # available on Python 3.10 and later: `with (x as y, a as b)`
67
+    'hypothesis != 6.130.13, != 6.131.*, != 6.132.*, != 6.133.*, != 6.134.*, != 6.135.0, != 6.135.1 ; python_version < "3.10"',
63 68
 ]
64 69
 export = [
70
+    # export - additional dependencies for `derivepassphrase export`
71
+    #
65 72
     # The vault configuration exporter relies on cryptography.
66 73
     # Version 38 was the first to include the `algorithms.AES256`
67 74
     # interface, instead of only the `algorithms.AES` interface, but
... ...
@@ -69,6 +76,17 @@ export = [
69 76
     # version we tested on.
70 77
     "cryptography >= 42.0.0",
71 78
 ]
79
+export-dev-wheels = [
80
+    # export-dev-wheels - wheel requirements for "export" in the "dev"
81
+    # setup
82
+    #
83
+    # `cryptography` 44.0.0 does not publish wheels for PyPy 3.9
84
+    # anymore.
85
+    'cryptography < 44 ; python_version < "3.10" and platform_python_implementation == "PyPy"',
86
+    # `cryptography` 44.0.1 is the first version to publish wheels for
87
+    # PyPy 3.11.
88
+    'cryptography > 44.0.1 ; python_version >= "3.11" and platform_python_implementation == "PyPy"',
89
+]
72 90
 
73 91
 [project.scripts]
74 92
 derivepassphrase = "derivepassphrase.cli:derivepassphrase"
... ...
@@ -289,6 +307,7 @@ dependencies = [
289 307
     "pytest >= 8.1",
290 308
     "pytest-randomly >= 3.15",
291 309
     "pytest-xdist[psutil] >= 3.6.0",
310
+    'hypothesis != 6.130.13, != 6.131.*, != 6.132.*, != 6.133.*, != 6.134.*, != 6.135.0, != 6.135.1 ; python_version < "3.10"',
292 311
 ]
293 312
 matrix-name-format = '{variable}_{value}'
294 313
 
... ...
@@ -305,6 +324,7 @@ parser-version = ["LL1"]
305 324
 [tool.hatch.envs.hatch-test.overrides]
306 325
 matrix.cryptography.features = [
307 326
     { value = "export", if = ["yes"] },
327
+    { value = "export-dev-wheels", if = ["yes"] },
308 328
 ]
309 329
 matrix.parser-version.env-vars = [
310 330
     { key = "PYTHONOLDPARSER", value = "1", if = ["LL1"] },
311 331