-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathpyproject.toml
More file actions
276 lines (240 loc) · 8.01 KB
/
Copy pathpyproject.toml
File metadata and controls
276 lines (240 loc) · 8.01 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
[project]
name = "hapi-nile"
version = "1.7.0"
description = "Distributed hydrological-model"
readme = {file = "README.md", content-type = "text/markdown"}
authors = [
{ name = "Mostafa Farrag", email = "moah.farag@gmail.com" }
]
license = {text = "GNU General Public License v3"}
keywords = ["Hydrology", "Distributed hydrological model"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: GIS",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
]
requires-python = ">= 3.11, <4"
dependencies = [
"loguru >=0.7.2",
"numpy >=2.1.3",
"pandas >=3.0.0",
"PyYAML >=6.0.2",
# GDAL is vendored inside the pyramids-gis wheel — do not pin gdal directly.
"pyramids-gis >=0.46.0",
"requests >=2.31.0",
"scipy >=1.17.0",
"serapeum-utils >=0.2.0",
"statista >=0.8.0",
"Oasis-Optimization >=1.0.3",
"cleopatra >=0.26.1",
"matplotlib >=3.11.0"
]
[dependency-groups]
dev = [
"nbval >=0.11.0",
"pre-commit >=3.7.1",
"pre-commit-hooks >=4.6.0",
"pytest >=8.2.2",
"pytest-cov >= 6.0.0",
"pytest-env >=1.6.0",
"pytest-mock >=3.12.0",
"pytest-timeout >=2.3.0",
"coverage",
"build >=1.0.0",
"twine >=5.0.0",
"pip",
"jupyterlab",
"notebook",
"jupyter",
"commitizen >=4.8.4",
"mypy >=1.10.0",
"types-PyYAML >=6.0.0"
]
docs = [
"mkdocs >=1.5.3",
"mkdocs-material >=9.5.3",
"mkdocstrings >=0.24.0",
"mkdocstrings-python >=1.7.5",
"mike >=2.1.3",
"mkdocs-jupyter >=0.25.1",
"mkdocs-autorefs >=1.2",
"mkdocs-macros-plugin >=1.3.7",
"mkdocs-table-reader-plugin >=3.1.0",
"mkdocs-mermaid2-plugin >=1.2.1",
"jupyter-contrib-nbextensions >=0.7.0",
"mkdocs-panzoom-plugin",
"notebook <7.0"
]
[project.urls]
homepage = "https://github.com/serapeum-org/Hapi"
repository = "https://github.com/serapeum-org/Hapi"
documentation = "https://serapeum-org.github.io/Hapi"
Changelog = "https://github.com/serapeum-org/Hapi/blob/main/docs/change-log.md"
[project.scripts]
download-parameters = "hapi.parameters.parameters:main"
download-parameter-set = "hapi.parameters.parameters:main"
list-parameter-names = "hapi.parameters.parameters:main"
[build-system]
requires = ["setuptools>=80.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
[tool.setuptools.packages.find]
where = ["src"]
include = ["hapi", "hapi.*"]
[tool.setuptools.package-data]
hapi = ["*.yaml", "include/gdal/*.h"]
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.format]
quote-style = "preserve"
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP"]
ignore = ["E203", "E226", "E266", "E501", "E701", "E722", "C901", "E741", "E731"]
[tool.ruff.lint.isort]
# Both spellings are named so sorting does not depend on filesystem case
# sensitivity: the legacy examples still import the pre-rename `Hapi.*` package.
known-first-party = ["hapi"]
known-third-party = ["Hapi"]
[tool.ruff.lint.per-file-ignores]
# Lint shipped src/ only; tests and examples keep import sorting (I) alone.
"tests/**" = ["E", "F", "W", "UP"]
"examples/**" = ["E", "F", "W", "UP"]
# Notebooks import next to first use, which legitimately trips E402.
"*.ipynb" = ["E402"]
[tool.bandit]
exclude_dirs = ["tests", "examples", "docs", "planning"]
skips = ["B101"]
[tool.coverage.run]
branch = true
source = ["src/hapi"]
[tool.coverage.report]
show_missing = true
# Locks in the current level; raise it as coverage improves.
fail_under = 50
[tool.commitizen]
name = "cz_conventional_commits"
version_provider = "pep621"
tag_format = "$version"
changelog_file = "docs/change-log.md"
update_changelog_on_bump = true
style = [
["qmark", "fg:#ff9d00 bold"],
["question", "bold"],
["answer", "fg:#ff9d00 bold"],
["pointer", "fg:#ff9d00 bold"],
["highlighted", "fg:#ff9d00 bold"],
["selected", "fg:#cc5454"],
["separator", "fg:#cc5454"],
["instruction", ""],
["text", ""],
["disabled", "fg:#858585 italic"]
]
[tool.mypy]
# 3.12, not the 3.11 floor: numpy's stubs use PEP 695 `type` statements, which
# mypy only parses at >= 3.12. The py311 test leg covers the runtime floor.
python_version = "3.12"
mypy_path = "src"
packages = ["hapi"]
explicit_package_bases = true
warn_return_any = true
warn_unused_configs = false
disallow_untyped_defs = false
check_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
warn_unused_ignores = true
exclude = [
"tests/",
"examples/",
"docs/",
"planning/",
]
[[tool.mypy.overrides]]
module = [
"hapi.catchment",
"hapi.run",
"hapi.calibration",
"hapi.wrapper",
]
# These modules are built by successive read_*() calls: attributes are typed
# X | None and populated before use, which mypy cannot verify. Removing the
# suppressions needs assert-based narrowing helpers first (~257 errors).
disable_error_code = [
"union-attr",
"attr-defined",
"arg-type",
"misc",
"operator",
"index",
"call-overload",
]
[[tool.mypy.overrides]]
module = "hapi.rrm.base_model"
disable_error_code = ["empty-body"]
[tool.pytest.ini_options]
env = [
"MPLBACKEND=Agg",
# D: only sets the default; an exported HAPI_DATA_DIR still wins.
"D:HAPI_DATA_DIR=src/hapi/parameters",
]
pythonpath = ["src"]
testpaths = ["tests"]
# Abort a stuck test instead of hanging CI.
timeout = 300
faulthandler_timeout = 120
markers = [
"vfs: mark a test as a virtual file system (deselect with '-m \"not vfs\"')",
"slow: mark test as slow (deselect with '-m \"not slow\"')",
"fast: mark test as fast (deselect with '-m \"not fast\"')",
"plot: test plotting function optional package (deselect with '-m \"not plot\"')",
"e2e: end-to-end test (deselect with '-m \"not e2e\"')",
"mock: mock test (deselect with '-m \"not mock\"')",
"integration: integration test (deselect with '-m \"not integration\"')",
"fig_share: FigShare API test (deselect with '-m \"not fig_share\"')"
]
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["win-64", "linux-64"]
[tool.pixi.pypi-dependencies]
hapi-nile = { path = ".", editable = true }
[tool.pixi.tasks]
plot = { cmd = "pytest -vvv --cov=src/hapi -sv -m 'plot' --cov-report=xml", description = "Run plot test suite" }
build-dist = { cmd = "python -m build", description = "Build sdist and wheel for PyPI" }
cz-changelog = { cmd = "cz changelog", description = "Generate changelog using Commitizen" }
cz-bump = { cmd = "cz bump", description = "Bump version using Commitizen" }
mypy = { cmd = "mypy", description = "Run mypy type checking" }
[tool.pixi.tasks.main]
cmd = "pytest -vvv --cov=src/hapi -sv -m 'not plot and not fig_share' --cov-report=xml"
description = "Run the main test suite"
[tool.pixi.tasks.test-all]
cmd = "pytest -vvv --cov=src/hapi -sv -m 'not fig_share' --cov-report=xml --cov-report=term-missing"
description = "Run all test suite"
[tool.pixi.tasks.notebooks]
cmd = "pytest --nbval --nbval-lax --verbose -p no:cacheprovider examples"
description = "Check notebooks (they still need migration off the pre-rename Hapi package)"
[tool.pixi.tasks.publish-pypi]
cmd = "twine upload --non-interactive --repository pypi dist/*"
depends-on = ["build-dist"]
description = "Build and upload package to PyPI"
[tool.pixi.environments]
default = { solve-group = "default" }
dev = { features = ["dev"], solve-group = "default" }
docs = { features = ["docs"], solve-group = "docs" }
py311 = { features = ["py311", "dev"], solve-group = "py311" }
py312 = { features = ["py312", "dev"], solve-group = "py312" }
py313 = { features = ["py313", "dev"], solve-group = "py313" }
[tool.pixi.feature.py311.dependencies]
python = "3.11.*"
[tool.pixi.feature.py312.dependencies]
python = "3.12.*"
[tool.pixi.feature.py313.dependencies]
python = "3.13.*"