-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
270 lines (241 loc) · 8.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
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
# Check this for proper formatting: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata
[project]
name = "ut"
version = "0.2.1"
description = "ut.ils comprises utility functions for (research) projects."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "Simon M. Hofmann", email = "[email protected]" },
]
maintainers = [
{ name = "Simon M. Hofmann", email = "[email protected]" },
]
keywords = ["utility", "helper", "utils"]
# Check for classifiers: https://pypi.org/classifiers/
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"numpy",
"psutil",
"requests",
"toml>=0.10; python_version < '3.11'",
]
[project.optional-dependencies]
vizual = [ # this is for `ut.viz`
"matplotlib>=3,<4",
"pandas>=2,<3",
"scikit-learn>=1,<2",
"statsmodels>=0.13,<1",
]
develop = [
"bumpver==2024.1130",
"ruff==0.8.4",
"tox==4.23.2",
"pre-commit==4.0.1",
"pytest==8.3.3",
"pytest-cov==6.0.0",
"python-dotenv==1.0.1",
]
[project.urls]
repository = "https://github.com/SHEscher/ut.ils"
[tool.setuptools]
platforms = ["unix", "linux", "osx", "cygwin", "win32"]
zip-safe = false
# # To automatically find the package(s) (Beta feature (Oct, 2022)):
[tool.setuptools.packages.find]
where = ["src"]
include = ["ut"]
exclude = ["tests"]
# Include non-python files in the package
# [options.package_data]
# ut = ["*.txt", "*.rst"]
# Exclude specific non-python files in the package
# [tool.setuptools.exclude-package-data]
# ut = [".gitattributes"]
# ALL ABOVE IS ADAPTATION OF THE FORMER setup.cfg
# ALL BELOW WAS ALREADY PART OF pyproject.toml [Oct, 2022]
[build-system]
requires = ["setuptools>=65", "wheel"]
build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
#addopts = "--cov=ut"
testpaths = ["src/tests"]
[tool.mypy]
mypy_path = "src"
check_untyped_defs = true
disallow_any_generics = true
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
no_implicit_reexport = true
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html
data_file = "src/tests/.coverage"
[tool.coverage.report]
exclude_lines = [
"if __name__ == .__main__.:",
"if TYPE_CHECKING:"
]
[tool.coverage.html]
directory = "src/tests/coverage_html_report"
[tool.ruff]
# Select rules / linters to apply
lint.select = [ # add /comment-out rules (the list below does not contain all rules)
# "ALL", # all rules
"D", # pydocstyle
"E", # pycodestyle [default]
"F", # Pyflakes [default]
"I", # isort imports
"RUF", # ruff specific
"UP", # pyupgrade [default]
"W", # pycodestyle: warning
"C90", # mccabe
"N", # pep8-naming
"ANN", # flake8-annotations (toggle on if you intend to work with type annotations)
"S", # flake8-bandit
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"FA", # flake8-future-annotations (see ANN above)
"ISC", # flake8-implicit-str-concat
# "ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"TD", # flake8-todos
"FIX", # flake8-fixme
"ERA", # eradicate
"PD", # pandas-vet
"PL", # Pylint
"NPY", # NumPy-specific rules
] # run `ruff linter` to see all rules
fix = false # true: Ruff will try to fix errors automatically
# List of rules to consider non-autofix-able.
lint.unfixable = [ # either with fix = true or when `ruff . --fix` is executed
"ERA001", # found commented-out code
"F401", # unused imports
# "RUF100", # `noqa` directives that are no longer applicable
]
# Ignore specific rules or the whole set of a rule
lint.ignore = [
"ANN101", # flake8-annotations: Missing type annotation for self in method
"ANN102", # flake8-annotations: Missing type annotation for cls in classmethod
"ANN401", # flake8-annotations: Any
"COM812", # Trailing comma missing
"D203", # 1 blank line required before class docstring: incompatible with D211 (=no blank line required)
"D212", # multi-line-summary-first-line incompatible with D213 (=should start at second line)
"DTZ005", # timezone-naive datetime
"E402", # Module level import not at top of file (covert by ISORT)
"ISC001", # single-line-implicit-string-concatenation (due to conflict with ruff formater)
"PLC0415", # `import` should be at the top-level of a file
"S301", # suspicious-pickle-usage
"TD002", # Missing author in To-Do
"TD003", # Missing issue link on the line following a To-Do
]
# lint.ignore-init-module-imports = true # void automatically removing unused imports in __init__.py [deprecated]
respect-gitignore = true # files and folder ignored in gitignore are ignore by ruff as well [default: true]
src = ["src/ut", "src/notebooks", "src/tests"]
# Exclude a variety of commonly ignored directories.
include = ["*.py", "*.pyi", "**/pyproject.toml"]
#extend-exclude = []
line-length = 119 # Same as flake8 and black
target-version = "py38" # assume Python 3.8 - 3.12
output-format = "concise" # "grouped" # default : "text"
preview = true # true: Ruff will use unstable rules and fixes; default: false
[tool.ruff.lint.extend-per-file-ignores]
# Ignore specific rules in specific files
"__init__.py" = ["F401", "D104"]
"*.ipynb" = ["D100"] # ignore docsstring in notebooks
"src/tests/*.py" = [
"S101", # ignore assert statements in tests
"PLR2004", # ignore "magic" value definition
"PLC2701", # private name import (_foo) is ok in tests
]
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
ignore-fully-untyped = true
suppress-none-returning = true
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.isort]
known-local-folder = ["src/ut"]
# known-first-party = ...
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds x.
max-complexity = 12 # default x: 10
[tool.ruff.lint.pep8-naming]
ignore-names = [] # fill with specific class, function, variable names
[tool.ruff.lint.pydocstyle]
# convention = "google" # "numpy", "pep257"
[tool.ruff.lint.pylint]
max-args = 10 # default: 5
max-branches = 13 # default: 12
max-returns = 6 # default: 6
max-statements = 50 # default: 50
# allow-magic-value-types = ["int"]
[tool.tox]
legacy_tox_ini = """
[tox]
min_version = 4.11.3
color = true
rootdir = "."
isolated_build = true
envlist = py{38,312}, lint
[testenv]
desciption = Run tests with pytest
skip_install = false
deps =
pytest>=8.2.2
python-dotenv==1.0.1
matplotlib>=3 # for viz
pandas>=2
scikit-learn>=1
statsmodels>=0.13
commands =
pytest . -k "not test_browse_files and not test_check_executor and not test_free_memory"
[testenv:lint]
description = "Run linters with ruff"
skip_install = false
deps =
ruff>=0.4.8
commands =
ruff check .
"""
# For instance, run in shell: bumpver update --patch --no-fetch --dry
[tool.bumpver]
current_version = "0.2.1"
version_pattern = "MAJOR.MINOR.PATCH"
pre_commit_hook = "scripts/badge.sh"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = true
push = true
[tool.bumpver.file_patterns]
"pyproject.toml" = ['^version = "{version}"', '^current_version = "{version}"']
"README.md" = ['version-v.{version}']
"src/ut/__init__.py" = ['^__version__ = "{version}"']