-
Notifications
You must be signed in to change notification settings - Fork 2
/
pyproject.toml
420 lines (411 loc) · 13.9 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
[build-system]
requires = ["flit_core==3.9.0"]
build-backend = "flit_core.buildapi"
[project]
name = "boilercv"
version = "2024.1.3"
description = "Computer vision routines suitable for nucleate pool boiling bubble analysis"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.11"
classifiers = [
"License :: OSI Approved :: MIT License",
# ? Also in CI (https://github.com/actions/python-versions/releases)
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
# "Programming Language :: Python :: 3.13", # ? (via myst-nb) https://github.com/crate-py/rpds/issues/72
# "Programming Language :: Python :: 3.14", # ? Not yet beta (https://peps.python.org/pep-0745)
]
dependencies = [
# TODO
"context-models>=0.0.1",
"matplotlib>=3.7.2",
"numpy>=1.24.4",
"numpydantic>=1.6.4",
"pandas[hdf5,performance]>=2.2.2",
"pillow>=10.3.0",
"pydantic>=2.9.1",
"pytz>=2023.3",
"sympy>=1.12",
"xarray[accel,io,parallel]>=2023.7.0",
# ? https://github.com/softboiler/boilercv/issues/213
"netcdf4>=1.6.5",
"netcdf4!=1.7.1.post1 ; sys_platform == 'linux'",
]
[project.optional-dependencies]
# * Minimal CV flavor needed, but allow `boilercv` to coexist with different flavors
cv = ["opencv-python>=4.10.0.84"]
[project.urls]
Changes = "https://softboiler.github.io/boilercv/changelog.html"
Docs = "https://softboiler.github.io/boilercv"
Home = "https://github.com/softboiler/boilercv"
Tracker = "https://github.com/softboiler/boilercv/issues"
[[project.authors]]
name = "Blake Naccarato, Kwang Jin Kim"
email = "blake.naccarato@gmail.com"
[tool.uv]
override-dependencies = ["cachier @ ${PROJECT_ROOT}/packages/cachier"]
constraint-dependencies = [
# ? Security
"fiona>=1.10.1",
"setuptools>=70.0.0",
# ? https://nvd.nist.gov/vuln/detail/CVE-2024-37891
# ? via sphinx
"urllib3>=2.2.2",
]
dev-dependencies = [
# TODO
"pycine @ git+https://github.com/ottomatic-io/pycine@815cfca06cafc50745a43b2cd0168982225c6dca",
# ? Workspaces
"boilercine",
"boilercore",
"boilercv_pipeline",
"context_models",
"dev",
# ? Path-sourced deps
"cachier",
# ? Dev
"debugpy>=1.8.2",
"dvc[gs]>=3.55.2",
"fawltydeps>=0.16.0",
"ipython>=8.26.0",
"pandas-stubs~=2.2.2",
"pipdeptree>=2.23.0",
"pipx>=1.6.0",
"pre-commit>=3.7.1",
"pyright>=1.1.371",
"ruff>=0.5.1",
"rust-just>=1.36.0",
"snakeviz>=2.2.0",
"sourcery>=1.21.0",
"towncrier>=23.11.0",
# ? Docs
"linkify-it-py>=2.0.3",
"myst-nb>=1.1.1",
"myst-parser>=3.0.1",
"sphinx-autobuild>=2024.4.16",
"sphinx-autodoc2>=0.5.0",
"sphinx-book-theme>=1.1.3",
"sphinx-design>=0.6.0",
"sphinx-thebe>=0.3.1",
"sphinx-tippy>=0.4.3",
"sphinx-togglebutton>=0.3.2",
"sphinxcontrib-bibtex>=2.6.2",
"sphinxcontrib-mermaid>=0.9.2",
"sphinxcontrib-towncrier>=0.4.0a0",
# ? Tests
"pytest-cov>=5.0.0",
"pytest-custom-exit-code>=0.3.0",
"pytest-github-actions-annotate-failures>=0.2.0",
"pytest-plt>=1.1.1",
"pytest-xdist[psutil,setproctitle]>=3.6.1",
]
[tool.uv.pip]
python-version = "3.11"
all-extras = true
[tool.uv.workspace]
members = ["packages/*"]
exclude = ["packages/cachier"]
[tool.uv.sources]
cachier = { path = "packages/cachier", editable = true }
dev = { workspace = true }
boilercine = { workspace = true }
boilercore = { workspace = true }
boilercv_pipeline = { workspace = true }
context_models = { workspace = true }
[tool.coverage.run]
branch = true
source = ["boilercv", "boilercv_pipeline", "dev", "tests"]
[tool.dev.env]
COVERAGE_CORE = "sysmon"
JUPYTER_PLATFORM_DIRS = "1"
PYDEVD_DISABLE_FILE_VALIDATION = "1"
PYTHONIOENCODING = "utf-8:strict"
PYTHONUTF8 = "1"
PYTHONWARNDEFAULTENCODING = "1"
PYTHONWARNINGS = "ignore"
[tool.fawltydeps]
deps = ["pyproject.toml"]
code = ["src"]
ignore_undeclared = ["_typeshed"]
ignore_unused = ["netcdf4"]
[tool.fawltydeps.custom_mapping]
context_models = ["context_models"]
pydantic = ["pydantic", "pydantic_core"]
[tool.pytest.ini_options]
addopts = """
--strict-config
--strict-markers
--suppress-no-test-exit-code
--color=yes
-p no:legacypaths
-r a
-n auto
--dist=loadfile
--plots=tests/plots
""" # ? `-n 0` because test suite is currently faster in series
cache_dir = ".cache/.pytest_cache"
markers = "slow"
testpaths = "tests"
xfail_strict = true
[tool.towncrier]
directory = "changelog"
filename = "CHANGELOG.md"
template = "changelog/towncrier_template.md.jinja"
title_format = ""
issue_format = "[#{issue}](https://github.com/softboiler/boilercv/issues/{issue})"
underlines = ["", "", ""]
[[tool.towncrier.section]]
path = ""
[[tool.towncrier.type]]
directory = "breaking"
name = "Backwards-incompatible changes"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "change"
name = "Changes"
showcontent = true
[tool.pyright]
stubPath = "typings/stubs"
exclude = [
"**/node_modules",
"**/__pycache__",
"**/.*",
".cache",
"typings",
"packages/boilercine",
"packages/boilercore",
"packages/cachier",
]
ignore = [
"**/node_modules",
"**/__pycache__",
"**/.*",
".cache",
"typings",
"packages/context_models",
]
typeCheckingMode = "strict"
# Default "true" in strict
analyzeUnannotatedFunctions = true
strictParameterNoneValue = true
enableTypeIgnoreComments = true
disableBytesTypePromotions = true
strictListInference = true
strictDictionaryInference = true
strictSetInference = true
# Default "false" in strict
deprecateTypingAliases = false
enableExperimentalFeatures = false
# Default "warning" in strict
reportMissingModuleSource = "warning"
# Default "error" in strict
reportMissingImports = "warning"
reportInvalidTypeForm = "none" # Works fine in BaseModels
reportUndefinedVariable = "warning"
reportAssertAlwaysTrue = "warning"
reportInvalidStringEscapeSequence = "warning"
reportInvalidTypeVarUse = "warning"
reportMissingTypeStubs = "none" # Overeager
reportSelfClsParameterName = "warning"
reportUnsupportedDunderAll = "warning"
reportUnusedExpression = "none" # Handled by Ruff
reportWildcardImportFromLibrary = "warning"
reportAbstractUsage = "warning"
reportArgumentType = "warning"
reportAssertTypeFailure = "warning"
reportAssignmentType = "warning"
reportAttributeAccessIssue = "warning"
reportCallIssue = "warning"
reportGeneralTypeIssues = "warning"
reportInconsistentOverload = "warning"
reportIndexIssue = "warning"
reportInvalidTypeArguments = "warning"
reportNoOverloadImplementation = "warning"
reportOperatorIssue = "warning"
reportOptionalSubscript = "warning"
reportOptionalMemberAccess = "warning"
reportOptionalCall = "warning"
reportOptionalIterable = "warning"
reportOptionalContextManager = "warning"
reportOptionalOperand = "warning"
reportRedeclaration = "warning"
reportReturnType = "warning"
reportTypedDictNotRequiredAccess = "warning"
reportPrivateImportUsage = "none" # Flaky regarding "not exported"
reportUnboundVariable = "warning"
reportUnusedCoroutine = "none" # Handled by Ruff
reportUnusedExcept = "warning"
reportFunctionMemberAccess = "warning"
reportIncompatibleMethodOverride = "warning"
reportIncompatibleVariableOverride = "warning"
reportOverlappingOverload = "warning"
reportPossiblyUnboundVariable = "warning"
reportConstantRedefinition = "none"
reportDeprecated = "warning"
reportDuplicateImport = "warning"
reportIncompleteStub = "warning"
reportInconsistentConstructor = "warning"
reportInvalidStubStatement = "warning"
reportMatchNotExhaustive = "warning"
reportMissingParameterType = "none"
reportMissingTypeArgument = "warning"
reportPrivateUsage = "none" # Ruff checks this well enough
reportTypeCommentUsage = "warning"
reportUnknownArgumentType = "none"
reportUnknownLambdaType = "none"
reportUnknownMemberType = "none"
reportUnknownParameterType = "none"
reportUnknownVariableType = "none"
reportUnnecessaryCast = "warning"
reportUnnecessaryComparison = "warning"
reportUnnecessaryContains = "warning"
reportUnnecessaryIsInstance = "warning"
reportUnusedClass = "none" # Handled by Ruff
reportUnusedImport = "none" # Handled by Ruff
reportUnusedFunction = "none" # Handled by Ruff
reportUnusedVariable = "none" # Handled by Ruff
reportUntypedBaseClass = "none"
reportUntypedClassDecorator = "warning"
reportUntypedFunctionDecorator = "none" # Often out of our control
reportUntypedNamedTuple = "warning"
# Default "none" in strict
reportCallInDefaultInitializer = "none"
reportImplicitOverride = "none"
reportImplicitStringConcatenation = "none"
reportImportCycles = "none"
reportMissingSuperCall = "none"
reportPropertyTypeMismatch = "none"
reportShadowedImports = "none"
reportUninitializedInstanceVariable = "warning" # Ensure we define instance vars
reportUnnecessaryTypeIgnoreComment = "none"
reportUnusedCallResult = "none"
[tool.ruff]
cache-dir = ".cache/.ruff_cache"
extend-exclude = [
"typings",
"packages/boilercine",
"packages/boilercore",
"packages/cachier",
"packages/context_models",
]
extend-include = ["*.ipynb"]
src = ["src", "docs", "pipeline", "scripts", "tests"]
output-format = "grouped"
fix = true
preview = true
show-fixes = true
[tool.ruff.lint]
fixable = ["ALL"]
select = [
"ALL", # Select all rules
"D417", # Explicitly enable parameter check even when using Numpy docstrings
]
unfixable = [
"PIE790", # Don't remove `pass`/`...`, overridden in pre-commit
]
extend-safe-fixes = [
"F401", # Allow autofix for unused imports even in `__init__.py`
]
ignore = [
"ANN", # Don't require type annotations
"ARG005", # Allow unused lambda argument. For consistency across df pipelines.
"C408", # Allow dict calls
"COM", # Allow magic commas and magic missing commas
"CPY001", # Don't check for copyright
"D105", # Allow missing docstring for magic methods
"DTZ", # Timezones are important, but only contextually necessary.
"E501", # Don't check line length. Black handles this.
"EM", # Don't check for exception message issues
"ERA", # False positives. Don't get rid of commented out code.
"FBT", # Allow boolean "traps"
"FIX002", # Allow TODOs
"FLY002", # Allow different string representations
"FURB118", # Incorrectly applies `itemgetter`
"FURB140", # Don't replace comprehensions with starmap
"G0", # Allow f-strings, etc. in Loguru logging
"ICN", # Don't require these ad-hoc "conventional" import names
"INP001", # False positives. Checks for packages missing `__init__.py`
"ISC", # False positives. Implicit string concatenation is fine.
"PD009", # Allow `df.iat`.
"PD011", # Allow use of `.values`. False positives.
"PD013", # Allow `stack` instead of `melt`. They're not a direct swap.
"PD101", # Allow use of nunique(). False positives
"PD901", # Allow `df` variable name. We are all consenting adults here.
"PD011", # Allow use of `.values`. False positives.
"PLR6201", # Don't require set literal for membership checks
"PGH003", # Until black stops wrapping special ignores, let's allow bare
"PIE804", # Allow dict unpack even if unnecessary, consisent for df.assign{**...}
"PLC0105", # Dont enforce Hungarian notation for `TypeVar` variance
"PLC2701", # Allow private name imports
"PLR0913", # Allow more than five function arguments
"PLR0914", # Allow lots of local variables
"PLR0917", # Allow more than five positional arguments
"PLR1704", # Allow redefining arguments, often for sanitization
"PLR2004", # Allow magic values. This check is too sensitive
"PLR6201", # Don't require set literal for membership checks
"PLR6301", # Allow methods that don't reference self, may be overridden
"PLW0108", # Don't warn about unnecessary lambda. Often needed in pandas chains
"PLW0642", # Allow reassignment to `cls` and `self`
"PLW2901", # For loop variable
"RET", # Return checks are flaky, Sourcery does fine analysing these paths
"S301", # Don't warn about pickling.
"S403", # Don't warn about pickle-like modules.
"S404", # Don't warn about subprocess.
"TCH", # Type checking linter doesn't play nicely with pydantic
"TD", # Disable to-do validation. Too pedantic for now.
"TRY003", # Allow long exception messages
"W2", # Allow whitespace issues. Fixed automatically by black.
]
[tool.ruff.lint.isort]
split-on-trailing-comma = false
[tool.ruff.format]
skip-magic-trailing-comma = true
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.extend-per-file-ignores]
"**/*.ipynb" = [
"B018", # Allow "useless" expressions, which do suppress outputs in notebooks
"E703", # Allow semicolons to suppress outputs in notebooks
"F821", # Allow undefined names, such as `display`
"S101", # Allow assert
"T201", # Allow print in notebooks
]
"docs/**.ipynb" = [
"E402", # Need to allow imports below patches in docs notebooks
]
"packages/_dev/dev/tools/add_changes.py" = [
"S603", # Allow shell expressions here
"S607", # Allow shell expressions here
]
"packages/pipeline/boilercv_pipeline/sync_dvc/dvc.py" = [
"D1", # Don't require docstrings
]
"packages/pipeline/boilercv_pipeline/models/generated/types/**/*.py" = [
"D10", # Allow missing docstrings in generated types
"PYI047", # Allow unused private generated types
"SLF001", # Allow private member access in generated types
]
"**/manual/**/*.py" = [
"D10", # Allow missing docstrings in stage implementations
]
"**/stages/**/*.py" = [
"D10", # Allow missing docstrings in stage implementations
"RUF012", # Disable this heuristic for Pydantic models with defaults
]
"tests/**" = [
"ARG001", # Allow unused arguments
"S101", # Allow assert
"SIM300", # Allow constants (expectations) on the RHS
"SLF001", # Allow private member access in tests
]
"tests/test_morphs.py" = [
"D101", # Allow not documenting a test class
"D103", # Allow not documenting a test function
"E302", # Allow manual spacing of test classes close to their headings
"E305", # Allow manual spacing of test classes close to their headings
]