Add static analysis and testing dependencies to "dev" extra
Marco Ricci

Marco Ricci commited on 2025-01-31 15:20:21
Zeige 1 geänderte Dateien mit 19 Einfügungen und 7 Löschungen.


This also enables the static analysis environment to directly use the
"dev" extra instead of re-declaring all dependencies.  (Sadly, the
testing environment needs manual re-declaration, because `cryptography`
is a transitive dependency of `hatch`, but the test suite needs to test
the "no cryptography support" scenario too.)
... ...
@@ -42,8 +42,18 @@ dynamic = ['version']
42 42
 [project.optional-dependencies]
43 43
 dev = [
44 44
   # Development uses the hatch build system, to isolate all tools in their
45
-  # own virtual environment.
45
+  # own virtual environment...
46 46
   "hatch ~= 1.10",
47
+  # ...but it is still sensible to have most static analysis tools available
48
+  # in the main virtual environment as well, so that your editor/IDE setup
49
+  # can access them as well.
50
+  "mypy ~= 1.0",
51
+  "ruff ~= 0.9.0",
52
+  # Test dependencies should be installed as well, to have static analysis
53
+  # in the test suite working too.
54
+  "hypothesis >= 6.0",
55
+  "packaging",  # The test suite compares version numbers.
56
+  "pytest ~= 8.1",
47 57
 ]
48 58
 export = [
49 59
   # The vault configuration exporter relies on cryptography.  Version 38 was
... ...
@@ -127,13 +137,19 @@ detached = false
127 137
 [tool.hatch.envs.hatch-static-analysis]
128 138
 config-path = "/dev/null"
129 139
 dependencies = [
130
-  "ruff ~= 0.8.0",
140
+    # Override the default dependencies, lest the ruff requirements
141
+    # conflict.
142
+]
143
+features = [
144
+    "dev",
131 145
 ]
132 146
 
133 147
 [tool.hatch.envs.hatch-test]
134 148
 default-args = ['src', 'tests']
135 149
 extra-dependencies = [
136 150
   "hypothesis >= 6.0",
151
+  "packaging",  # The test suite compares version numbers.
152
+  "pytest ~= 8.1",
137 153
 ]
138 154
 matrix-name-format = '{variable}_{value}'
139 155
 
... ...
@@ -162,12 +178,8 @@ cov-combine = "coverage combine"
162 178
 cov-report = "coverage report"
163 179
 
164 180
 [tool.hatch.envs.types]
165
-extra-dependencies = [
166
-  "hypothesis >= 6.0",
167
-  "mypy ~= 1.0",
168
-  "pytest ~= 8.1",
169
-]
170 181
 features = [
182
+    "dev",
171 183
     "export",
172 184
 ]
173 185
 
174 186