-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpyproject.toml
More file actions
213 lines (195 loc) · 5.5 KB
/
Copy pathpyproject.toml
File metadata and controls
213 lines (195 loc) · 5.5 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "simcenter-dlml"
version = "3.2.dev0"
description = "Damage and Loss Model Library"
readme = "README.md"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.9"
authors = [
{ name = "Adam Zsarnóczay", email = "adamzs@stanford.edu" },
]
keywords = [
"natural-hazards",
"fragility",
"consequence",
"damage-and-loss",
"pelicun",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
]
dependencies = [
"pandas>=2.0",
"numpy>=1.22",
"jsonschema>=4.0",
]
[project.optional-dependencies]
# The DLML Explorer web app (`dlml explorer`). numpy and pandas come from the
# core dependencies above. Note: qdrant-client[fastembed] pulls onnxruntime,
# whose wheels target modern CPythons, so `simcenter-dlml[explorer]` effectively
# Python >=3.10 even though the core library supports 3.9. The first search run
# downloads the embedding model from HuggingFace (`dlml explorer` warms it up
# front; the app also degrades gracefully if the download or the dependencies
# are unavailable).
explorer = [
"streamlit>=1.48.0",
"plotly",
"colorlover",
"scipy",
"qdrant-client[fastembed]>=1.14.0",
]
test = [
# Pin to the 3.9 line: it matches the offline-import guard in
# tests/test_pelicun_equivalence.py, and it stops the resolver from picking
# a pelicun that would fetch DLML data from the frozen releases/latest during
# CI. Pelicun 3.10 will depend on dlml itself -- revisit then.
"pelicun>=3.9,<3.10",
"pytest>=7",
"pytest-cov",
]
# Lint / type / spell tooling, kept separate from `explorer` so CI can install
# it on Python 3.9.
lint = [
"ruff==0.7.0",
"codespell",
"mypy",
]
# Dependencies for building the Sphinx documentation website (doc/). The doc
# generators render fragility/consequence plots, so they need plotly, colorlover
# and scipy; they use dlml's own convert_to_MultiIndex, so no pelicun.
doc = [
"sphinx",
"sphinx-design",
"sphinx-rtd-theme",
"sphinxcontrib-bibtex",
"numpydoc",
"tqdm",
"plotly",
"colorlover",
"scipy",
]
# Everything for local development. Requires Python >=3.10 (via the `explorer`
# extra's onnxruntime dependency).
dev = [
"simcenter-dlml[test,explorer,lint,doc]",
]
[project.scripts]
dlml = "dlml.cli:main"
[project.urls]
Homepage = "https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary"
Documentation = "https://nheri-simcenter.github.io/DamageAndLossModelLibrary/"
Repository = "https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary"
# Streamlit Community Cloud installs dependencies with `uv sync` when a uv.lock
# is present, and `uv sync` installs the base package plus DEFAULT GROUPS but NOT
# optional-dependency extras. Expose the web deps as a default group that simply
# references the `explorer` extra (single source of truth), so the deployed app
# gets everything it needs. This does not affect the published wheel: dependency
# groups are dev-time only, so `pip install simcenter-dlml` stays lightweight.
[dependency-groups]
deploy = ["simcenter-dlml[explorer]"]
[tool.uv]
default-groups = ["deploy"]
[tool.hatch.build.targets.wheel]
packages = ["src/dlml"]
exclude = [
"**/__pycache__/**",
"**/*.pyc",
]
[tool.hatch.build.targets.sdist]
include = [
"src/dlml",
"README.md",
"LICENSE",
]
exclude = [
"**/__pycache__/**",
"**/*.pyc",
]
[tool.ruff]
line-length = 85
extend-exclude = ["src/dlml/data", "src/dlml/web", "doc"]
# Honor extend-exclude even when a path is passed explicitly (pre-commit,
# editors), so the web app is never linted by any invocation.
force-exclude = true
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN",
"D211",
"D212",
"Q000",
"Q003",
"COM812",
"D203",
"ISC001",
"E501",
"ERA001",
"PGH003",
"FIX002",
"TD003",
"S101",
"N801",
"S311",
"G004",
"SIM102",
"SIM108",
"NPY002",
"F401",
"INP001",
"PLR2004",
"D100",
]
preview = false
[tool.ruff.lint.per-file-ignores]
"*.ipynb" = ["ALL"]
"tests/*" = ["D", "N802", "SLF001", "PLR2004", "PLR6301"]
# The CLI prints to stdout by design (that is its user interface).
"src/dlml/cli.py" = ["T201"]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.pylint]
max-args = 15
max-locals = 50
max-returns = 11
max-branches = 50
max-statements = 150
max-bool-expr = 5
[tool.ruff.format]
quote-style = "single"
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.coverage.run]
# The web/ subpackage (the Streamlit app) is not exercised by the test suite;
# omit it so the UI modules do not count against the coverage.
omit = ["*/dlml/web/*"]
[tool.mypy]
files = ["src/dlml"]
# The data tree holds pelicun-specific authoring/config scripts, and web/ is
# the Streamlit app (excluded from every gate for now) -- neither is part of
# the typed dlml API.
exclude = "^src/dlml/(data|web)/"
ignore_missing_imports = true
[tool.codespell]
ignore-words = ["ignore_words.txt"]
skip = [
"*.html",
"*/build/*",
"*/DB/*",
"src/dlml/data/*",
"src/dlml/web/*",
"data_sources/*",
"*/.venv/*",
"./dist/*",
]