-
Notifications
You must be signed in to change notification settings - Fork 7
/
pyproject.toml
226 lines (198 loc) · 5.22 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
[tool.poetry]
authors = ["Trygve Aspelien <[email protected]>"]
description = "surfExp"
name = "surfexp"
readme = "README.rst"
version = "0.3.0"
include = [ {path="surfexp/data", format = ["sdist", "wheel"]} ]
[tool.poetry.scripts]
execute_task = "surfexp.templates.cli:execute_task"
surfExp = "surfexp.cli:pysfxexp"
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core >= 1.0.0"]
[tool.poetry.dependencies]
#deode = {git = "[email protected]:trygveasp/Deode-workflow-copy.git", develop = true, branch = "develop_ppi"}
#deode = {path = "/modules/rhel8/user-apps/suv-modules/deode/trygveasp/feature/develop_ppi", develop=true}
pysurfex = {git = "https://github.com/metno/pysurfex.git", develop = true, branch = "master"}
python = ">=3.9,<3.13"
[tool.poetry.group.linting.dependencies]
black = {extras = ["jupyter"], version = "^23.10.0"}
flake8 = ">=4.0.1, <5.0.0"
flakeheaven = "^3.3.0"
isort = "^5.12.0"
ruff = "^0.1.0"
toml-formatter = {git = "https://github.com/paulovcmedeiros/toml-formatter"}
# flake8 plugins for stuff not yet on ruff.
# See <https://github.com/astral-sh/ruff/issues/458>.
poethepoet = {extras = ["poetry-plugin"], version = "0.24.4"}
pydoclint = "^0.3.8" # Replaces darglint, but is maintained & faster
[tool.poetry.group.test.dependencies]
pytest = "^7.2.2"
pytest-cov = "^4.1.0"
pytest-mock = "^3.7.0"
pytest-profiling = "^1.7.0"
pytest-timeout = "^2.1.0"
pytest-xdist = "^3.2.0"
coveralls = "^3.3.1"
sphinx = "^6.1.3"
sphinx-rtd-theme = "^1.2.0"
##################
# Linter configs #
##################
[tool.black]
line-length = 90
[tool.flakeheaven]
exclude = [".*/", "tmp/", "*/tmp/", "*.ipynb"]
format = "colored"
# Show line of source code in output, with syntax highlighting
show_source = true
style = "google"
# list of plugins and rules for them
[tool.flakeheaven.plugins]
# Deactivate all rules for all plugins by default
"*" = ["-*"]
# Activate only those plugins not covered by ruff
pydoclint = []
[tool.isort]
line_length = 90
profile = "black"
[tool.ruff]
ignore = [
"C901",
"D105",
"EXE001",
"PLE1205",
"PLR0912",
"PLR0915",
"PLR0913",
"PLR2004",
"RET504",
"RUF012",
]
line-length = 90
select = [
"A",
"ARG",
"B",
"BLE",
"C4",
"C90",
"D",
"E",
"ERA",
"EXE",
"F",
"G",
"I",
"N",
"PD",
"PERF",
"PIE",
"PL",
"PT",
"Q",
"RET",
"RSE",
"RUF",
"S",
"SIM",
"SLF",
"T20",
"W",
]
[tool.ruff.per-file-ignores]
# S101: Use of `assert` detected
"scheduler.py" = ["T201"]
"tests/**/*.py" = [
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"E501",
"S101",
"SLF001",
]
[tool.ruff.pydocstyle]
convention = "google"
[tool.toml-formatter]
indentation = 2
section_order_overrides = [
"^general$",
"general.*",
"^tool.poetry$",
"^tool.poetry.scripts$",
"build-system",
"tool.poetry.*",
]
##################
# pytest configs #
##################
[tool.pytest.ini_options]
addopts = "-v --failed-first --cov-report=term-missing --cov-report=term:skip-covered --cov-report=xml:.coverage.xml --cov=./"
log_cli_level = "INFO"
testpaths = ["tests/smoke", "tests/unit"]
####################################
# Leave configs for `poe` separate #
####################################
[tool.poe]
poetry_command = "devtools"
[tool.poe.tasks]
# Doc-related stuff
_doc_build.shell = """
surfexp doc config >| docs/markdown_docs/config.md
sphinx-apidoc surfexp -o docs/ --force --no-toc --module-first
sphinx-build docs docs/_build/
touch docs/_build/.nojekyll
"""
# Linting tasks
_black = "black ."
_isort = "isort ."
_ruff = "ruff check ."
_toml_formatter = "toml-formatter check ."
# Test-related tasks
pytest = "pytest"
# Tasks to be run as pre-push checks
pre-push-checks = ["lint", "doc clean", "doc build", "pytest"]
[tool.poe.tasks._flake8]
cmd = "flakeheaven lint ."
env = {FLAKEHEAVEN_CACHE_TIMEOUT = "0"}
[tool.poe.tasks.doc]
args = [
{name = "doc_action", positional = true, help = "{all,clean,build,view}", default = "all"},
]
control = {expr = "doc_action"}
[[tool.poe.tasks.doc.switch]]
case = "all"
sequence = ["doc build", "doc view"]
[[tool.poe.tasks.doc.switch]]
case = "clean"
cmd = "rm -rf docs/_build/ docs/deode.rst docs/markdown_docs/config.md"
[[tool.poe.tasks.doc.switch]]
case = "build"
sequence = ["doc clean", "_doc_build"]
[[tool.poe.tasks.doc.switch]]
case = "view"
sequence = [
{shell = "[ ! -f docs/_build/index.html ] && poetry devtools doc build || exit 0"},
{script = "webbrowser:open('docs/_build/index.html')"},
]
[tool.poe.tasks.lint]
args = [{name = "fix", type = "boolean", default = false}]
control = {expr = "fix"}
[[tool.poe.tasks.lint.switch]]
case = "True"
#sequence = ["_isort", "_black", "_ruff --fix", "_flake8", "_toml_formatter --fix"]
sequence = ["_isort", "_black", "_ruff --fix", "_toml_formatter --fix"]
[[tool.poe.tasks.lint.switch]]
case = "False"
sequence = [
"_isort --check-only",
"_black --check --diff",
"_ruff",
"_toml_formatter",
]