generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
pyproject.toml
164 lines (146 loc) · 4.07 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
# --- ruff -------------------------------------------------------------------
[tool.ruff]
select = [
'A', # flake8 builtins
'B', # flake8 bugbear
'C4', # flake8 comprehensions
'C90', # mccabe
'D', # pydocstyle
'E', # pycodestyle
'F', # pyflakes
'I', # isort
'N', # pep8-naming
# 'PTH', # flake8-use-pathlib
'Q', # flake8-quotes
'S', # bandit
'SIM', # flake8-simplify
'TRY', # tryceratops
'W', # pycodestyle
# 'T20', # flake8 print
]
# Avoid trying to fix extension types:
unfixable = ["B"]
ignore = [
"B905", # zip strict=True; remove once python <3.10 support is dropped.
"D100", # do not require module-level docstrings
"D104", # do not require package docstrings
"D107", # do not require docstrings in __init__ files
"D205", # don't require linebreak after docstring (ruff vs black conflict)
# "E203", # not in ruff
# "E265", # not in ruff
# "E266", # not in ruff
"E501", # line too long
"F401", # unused import
"F403", # import *
"F405", # defined from import *
# "F541", # f-string missing placeholders
"N999", # allow "invalid" module names due to jinja templates
# "S101", # assert
"S311", # allow psuedorandom generators (we use for stats)
"SIM105", # allow except: pass
"TRY003", # Avoid specifying messages outside exception class; overly strict, especially for ValueError
"TRY201", # Allow raise without exception name (align with Sonarlint)
# "W503", # not in ruff
]
exclude = [
"*.egg-info",
".direnv",
".eggs",
".env",
".envrc",
".git",
".ipynb_checkpoints",
".nox",
".pytest_cache",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"ci/templates",
"build",
"dist",
"docs/conf.py",
"venv",
]
# Default autofix behavior
fix = true
# Max line length
line-length = 119
# Directories with source code
src = ["notebooks", "src", "tests"]
# Assumed Python version
target-version = "py39"
[tool.ruff.per-file-ignores]
# # Ignore `E402` (import violations) in all `__init__.py` files,
# # and in `path/to/file.py`.
# "__init__.py" = ["E402"]
# "path/to/file.py" = ["E402"]
".ci/*" = ["D"]
"docs/*" = ["D"]
"notebooks/*" = ["B018", "D", "S101"]
"tests/*" = ["D", "S101"]
# --- ruff plugins --------------------
[tool.ruff.flake8-bugbear]
extend-immutable-calls = ["chr", "typer.Argument", "typer.Option"]
[tool.ruff.isort]
combine-as-imports = true
extra-standard-library = ["yaml"]
# forced-separate = ["scipy", "sklearn", "statsmodels", "torch"]#, "ds_utils", "src"]
force-sort-within-sections = true
force-wrap-aliases = true
# known-first-party = ["ds_utils"]
known-local-folder = ["src"] # for relative imports
section-order = ["standard-library", "third-party", "sci", "torch", "plot", "pmi", "first-party", "local-folder"]
[tool.ruff.isort.sections]
"sci" = ["numpy", "pandas", "scipy", "sklearn", "statsmodels"]
"torch" = ["torch", "tokenizers", "transformers"]
"plot" = ["cmcrameri", "matplotlib", "plotly", "plotnine", "seaborn"]
"pmi" = ["ds_utils", "psm", "recommender"]
[tool.ruff.mccabe]
max-complexity = 18
[tool.ruff.pep8-naming]
ignore-names = []
[tool.ruff.pydocstyle]
convention = "numpy"
# --- pytest -----------------------------------------------------------------
# ref: https://docs.pytest.org/en/7.3.x/reference/customize.html
[tool.pytest.ini_options]
addopts = '''
-ra
--strict-markers
--ignore=docs/conf.py
--ignore=setup.py
--ignore=ci
--ignore=.eggs
--import-mode=importlib
--tb=short
'''
# --doctest-modules
# --doctest-glob=\*.rst
norecursedirs = [
".env",
".git",
".nox",
".pytest_cache",
".tox",
"__pycache__",
"dist",
"docs",
"build",
"migrations",
"notebooks",
"writeup",
]
python_files = ["test_*.py", "*_test.py", "tests.py"]
pythonpath = "src"
testpaths = ["tests"]
# log_cli = true
# --- coverage ---------------------------------------------------------------
[tool.coverage.paths]
source = ["src", "*/site-packages"]
[tool.coverage.run]
branch = true
source = ["src"]
[tool.coverage.report]
show_missing = true