-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
355 lines (326 loc) · 9.88 KB
/
pyproject.toml
File metadata and controls
355 lines (326 loc) · 9.88 KB
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
[project]
name = "rdetoolkit"
version = "1.6.3"
description = "A module that supports the workflow of the RDE dataset construction program"
authors = [{ name = "NIMS MDPF", email = "rde@nims.go" }]
keywords = ["rdetoolkit", "RDE", "toolkit", "structure", "dataset"]
classifiers = [
'Development Status :: 3 - Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Rust',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS',
'Typing :: Typed',
]
dependencies = [
"chardet>=5.2.0",
"charset-normalizer>=3.2.0",
"openpyxl>=3.1.2",
"pandas>=2.2.3",
"build>=1.0.3",
"typer>=0.9.0",
"toml>=0.10.2",
"pydantic>=2.8.3",
"jsonschema>=4.21.1",
"tomlkit>=0.12.4",
"PyYAML>=6.0.1",
"eval_type_backport>=0.2.0",
"typing-extensions>=4.12.2; python_version < '3.11'",
"numpy>=1.26.4",
"polars>=1.9.0",
"pyarrow>=19.0.0",
"pip>=24.3.1",
"rpds-py>=0.26",
"markdown>=3.7",
"matplotlib>=3.9.4",
]
readme = "README.md"
requires-python = ">= 3.10"
[project.optional-dependencies]
minio = ["minio>=7.2.15"]
plotly = ["plotly>=6.3.1"]
[tool.setuptools]
package_data = { "rdetoolkit" = ["py.typed", "*.pyi", "_agent/*.md"] }
[project.scripts]
rdetoolkit = "rdetoolkit.cli.app:app"
[project.urls]
"Homepage" = "https://github.com/nims-dpfc/rdetoolkit"
"Bug Tracker" = "https://github.com/nims-dpfc/rdetoolkit"
[build-system]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"
[dependency-groups]
dev = [
"black>=23.7.0",
"flake8>=6.0.0",
"pyproject-flake8>=6.0.0.post1",
"isort>=5.12.0",
"lizard>=1.17.10",
"mypy>=1.18.2",
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.11.1",
"pytest-mpl>=0.17.0",
"tox>=4.6.4",
"types-python-dateutil>=2.8.19.14",
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.1",
"mkdocstrings[crystal,python]>=0.27.0",
"pre-commit>=3.6.0",
"types-PyYAML>=6.0.12.20240311",
"mkdocs-mermaid2-plugin>=1.1.1",
"ruff>=0.5.5",
"jsonschema-markdown>=0.3.8",
"mike>=2.1.3",
"mkdocs-static-i18n>=1.3.0",
"mkdocs-redirects>=1.2.2",
"plotly>=6.3.1",
"minio>=7.2.15",
"superclaude>=4.1.5",
"tox-uv>=1.28.0",
"hypothesis>=6.102.0",
]
# requires = ["hatchling"]
# build-backend = "hatchling.build"
[tool.maturin]
python-source = "src"
module-name = "rdetoolkit.core"
features = ["pyo3/extension-module"]
# The team has agreed not to enforce a maximum character limit per line.
[tool.ruff]
line-length = 250
indent-width = 4
target-version = "py310"
[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle
"W", # pycodestyle warnings
"I", # isort
"D", # pydocstyle
"N", # pep8-naming
"PL", # Pylint,
"C90", # mccabe
"UP", # pyupgrade
"ANN", # flake8-annotations
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"EM", # flake8-errmsg
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T10", # flake8-debugger
"T20", # flake8-print
"PYI", # flake8-pyi
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
]
ignore = [
"I001",
"D100",
"D101",
"D104",
"D105",
"D107",
"PLR0913",
"S307",
"ANN002",
"ANN003",
"ANN401",
"BLE001",
"UP007",
"UP045",
]
exclude = [
"bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"tests",
"stubs",
"src/rdetoolkit/**/*.pyi",
"src/rdetoolkit/models/invoice_schema.py", # Ignore pydocstyle warnings for this file as it is for defining pydantic models.
]
[tool.ruff.format]
indent-style = "space"
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
# Unused imports are allowed in __init__.py.
"__init__.py" = ["F401", "F403", "PLC0415"]
"src/rdetoolkit/cli.py" = ["PLC0415"]
"src/rdetoolkit/errors.py" = ["PLC0415"]
"src/rdetoolkit/fileops.py" = ["PLC0415"]
# TODO: Refactor parse_config_file to reduce complexity (Issue #361)
"src/rdetoolkit/config.py" = ["C901", "PLR0912"]
"src/rdetoolkit/graph/__init__.py" = ["PLC0415"]
"src/rdetoolkit/graph/api/csv2graph.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile/_helpers.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile/_sheet_processing.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile/_description.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile/_excelinvoice.py" = ["PLC0415"]
"src/rdetoolkit/invoicefile/_invoice.py" = ["PLC0415"]
"src/rdetoolkit/rde2util.py" = ["PLC0415"]
"src/rdetoolkit/validation.py" = ["PLC0415"]
"src/rdetoolkit/workflows.py" = ["PLC0415"]
"**/*.pyi" = ["ALL"]
# Test files can use assert statements and don't need full type annotations
"tests/**/*.py" = ["S101", "ANN", "SLF001", "PLC0415", "PLR2004", "S603", "S607"]
# Property tests use pytest.importorskip which requires imports after the skip
"tests/property/**/*.py" = ["S101", "ANN", "SLF001", "PLC0415", "PLR2004", "E402", "PYI041"]
# CLI commands use lazy imports for performance
"src/rdetoolkit/cli/*.py" = ["PLC0415"]
"src/rdetoolkit/cli/app.py" = ["FA100"]
# Type Checking Configuration
#
# Enhanced type safety through NewType and ValidatedPath classes
# introduced in Issue #335. Configuration balances strictness with
# gradual migration path for existing code.
#
# Key features:
# - NewType creates distinct type identities for compile-time checking
# - ValidatedPath hierarchy provides runtime validation
# - Per-module overrides enable stricter checking for new code
# - Existing modules maintain current checking level for compatibility
#
# NewType Checking Behavior:
#
# ZipFilePath = NewType('ZipFilePath', Path)
#
# At type checking time:
# - ZipFilePath is distinct from Path and other NewTypes
# - Assignments between incompatible NewTypes are errors
# - Must use constructor: zip_path = ZipFilePath(Path("file.zip"))
#
# At runtime:
# - ZipFilePath(x) is just the identity function returning x
# - No performance overhead, purely for type checking
# - isinstance(zip_path, ZipFilePath) is False (it's a Path)
[tool.mypy]
# Display options
show_error_context = true
show_column_numbers = true
show_error_codes = true
# Import handling
ignore_missing_imports = true
# Type checking strictness
strict_optional = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
# NewType and type alias handling
# Ensure NewType creates distinct types at type checking time
disallow_any_generics = false # Allow for gradual migration
# Path exclusions
exclude = ["tests", "src/rdetoolkit/stubs", '.*\.pyi$']
# Mypy Plugins (currently not required)
# plugins = []
#
# Future considerations:
# - Custom plugin for advanced ValidatedPath validation
# - Plugin for FileGroup type narrowing
# - Integration with pydantic if needed
# Per-module overrides for gradual adoption
[[tool.mypy.overrides]]
module = "rdetoolkit.models.rde2types"
# Enable stricter checking for the module with new types
disallow_untyped_defs = true
disallow_any_explicit = false # Allow explicit Any during migration
warn_return_any = true
warn_unreachable = true
check_untyped_defs = true
[tool.coverage.run]
omit = ["tests/*", "interfaces/*", "local/*"]
[tool.coverage.report]
exclude_also = [
"def __repr__",
"if self\\.debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
[tool.pytest.ini_options]
addopts = "--mpl -m 'not legacy'"
testpaths = ["tests"]
markers = [
"graph_outputs: marks tests that generate graph outputs (deselect with '-m \"not graph_outputs\"')",
"legacy: marks legacy compatibility tests (deselected by default)",
"property: marks property-based tests using Hypothesis (deselect with '-m \"not property\"')",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
[tool.rye]
managed = true
dev-dependencies = [
"black>=23.7.0",
"flake8>=6.0.0",
"pyproject-flake8>=6.0.0.post1",
"isort>=5.12.0",
"lizard>=1.17.10",
"mypy>=1.5.1",
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.11.1",
"tox>=4.6.4",
"types-python-dateutil>=2.8.19.14",
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.1",
"mkdocstrings[crystal,python]>=0.27.0",
"pre-commit>=3.6.0",
"types-PyYAML>=6.0.12.20240311",
"mkdocs-mermaid2-plugin>=1.1.1",
"ruff>=0.5.5",
"jsonschema-markdown>=0.3.8",
"mike>=2.1.3",
"minio>=7.2.15",
"mkdocs-static-i18n>=1.3.0",
"mkdocs-redirects>=1.2.2",
]
[tool.rye.scripts]
generate-stubs = "stubgen -o src/ src/rdetoolkit/"
export-locks = "bash -c 'uv lock && uv export --no-dev --extra minio --format requirements-txt --no-editable > requirements.lock && uv export --group dev --extra minio --format requirements-txt --no-editable > requirements-dev.lock && sed -i '' \"/^\\.$/d\" requirements-dev.lock'"