Annotate settings and selections in pyproject.toml
Marco Ricci

Marco Ricci commited on 2024-07-28 22:44:39
Zeige 1 geänderte Dateien mit 21 Einfügungen und 1 Löschungen.


Annotate all extra dependencies or configuration choices that I may
otherwise forget the reasoning for in the long run.
... ...
@@ -81,9 +81,17 @@ path = "mkdocs.yml"
81 81
 
82 82
 [tool.hatch.envs.docs]
83 83
 extra-dependencies = [
84
+  # Our documentation uses the Material theme.  It also uses
85
+  # `mkdocstrings[python]`, but `hatch-mkdocs` is apparently smart
86
+  # enough to pick *that* one up from the MkDocs configuration, but not
87
+  # the selected theme...
88
+  "mkdocs-material",
89
+  # Our documentation uses formatted function signatures (i.e. with
90
+  # formatted type annotations), which requires `black`.
84 91
   "black",
92
+  # Our documentation is generated in multiple versions, orchestrated by
93
+  # `mike`.
85 94
   "mike",
86
-  "mkdocs-material",
87 95
 ]
88 96
 detached = false
89 97
 
... ...
@@ -138,9 +146,12 @@ preview = true
138 146
 [tool.ruff.lint]
139 147
 preview = true
140 148
 extend-ignore = [
149
+    # We use `assert` regularly to appease the type checker, and because
150
+    # it is the right language tool for this job.
141 151
     'S101',
142 152
 ]
143 153
 extend-select = [
154
+    # Unlike hatch's standard configuration, we care about line length.
144 155
     'E501',
145 156
 ]
146 157
 
... ...
@@ -152,9 +163,18 @@ parametrize-names-type = 'list'
152 163
 
153 164
 [tool.ruff.lint.extend-per-file-ignores]
154 165
 "**/tests/**/*" = [
166
+  # Our tests are pytest-style tests, which use `assert` liberally.
155 167
   'A002',
168
+  # Our tests are regularly parametrized with booleans, for benign
169
+  # purposes.
156 170
   'FBT001',
171
+  # One of our standard modules is called `derivepassphrase._types`.
172
+  # Importing this from the tests directory would then automatically
173
+  # trigger `PLC2701`.
157 174
   'PLC2701',
175
+  # To fully test the `derivepassphrase.cli` module (and a couple other
176
+  # things), we need to call and to mock several internal functions,
177
+  # which would automatically trigger `SLF001`.
158 178
   'SLF001',
159 179
 ]
160 180
 
161 181