forked from rotki/rotki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
289 lines (264 loc) · 10.2 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
[build-system]
requires = ["setuptools==67.3.2", "setuptools-scm==7.1.0"]
build-backend = "setuptools.build_meta"
[project]
name = "rotkehlchen"
authors = [
{name = "Rotki Solutions GmbH", email = "[email protected]"},
]
description = "Acccounting, asset management and tax report helper for cryptocurrencies"
readme = "README.md"
requires-python = ">=3.11"
keywords = ["accounting tax-report", "portfolio asset-management", "cryptocurrencies"]
classifiers = [
"Development Status :: 1 - Planning",
"Topic :: Utilities",
]
license = {file = "LICENSE.md"}
dynamic = ["dependencies", "version"]
[project.urls]
homepage = "https://rotki.com"
documentation = "https://rotki.readthedocs.io/en/stable/"
repository = "https://github.com/rotki/rotki"
changelog = "https://github.com/rotki/rotki/blob/develop/docs/changelog.rst"
[tool.setuptools.packages.find]
where = ["."] # list of folders that contain the packages (["."] by default)
include = ["rotkehlchen*"]
[project.scripts]
rotkehlchen = "rotkehlchen.__main__:main"
rotkehlchen_mock = "rotkehlchen_mock.__main__:main"
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
[tool.setuptools_scm]
fallback_version = "1.33.1"
[tool.setuptools.package-data]
"rotkehlchen.data" = ["*"]
"rotkehlchen.chain" = ["ethereum/modules/dxdaomesa/data/contracts.json"]
# -- Mypy config section --
[tool.mypy]
# Docs: https://mypy.readthedocs.io/en/latest/config_file.html
ignore_missing_imports = true
check_untyped_defs = true
disallow_untyped_defs = true
warn_unused_configs = true
warn_unused_ignores = true
warn_unreachable = true
warn_redundant_casts = true
disallow_untyped_decorators = true
disallow_untyped_calls = true
mypy_path="./stubs/"
[[tool.mypy.overrides]]
module = "rotkehlchen.*"
ignore_missing_imports = false
# -- These modules still need to have proper type definitions given --
[[tool.mypy.overrides]]
module = "rotkehlchen.tests.*"
check_untyped_defs = false
disallow_untyped_defs = false
# Pytest's fixture decorators are not typed
disallow_untyped_decorators = false
# custom pylint checkers still need to be typed
[[tool.mypy.overrides]]
module = "tools.pylint.*"
check_untyped_defs = false
disallow_untyped_defs = false
# profiling is not typed
[[tool.mypy.overrides]]
module = "tools.profiling.*"
check_untyped_defs = false
disallow_untyped_defs = false
# -- ruff config section --
[tool.ruff]
line-length = 99
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
target-version = "py311"
[tool.ruff.lint]
preview = true # https://docs.astral.sh/ruff/preview/
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
select = [
"E",
"F",
"W",
"C",
# "I", # isort -- not using since does not play well with running isort too
# "D", # pydocstyle -- too many docstuff we don't use
"N",
"B",
"G",
# "EM", # our exceptions use f strings everywhere. Very little upside to this and I don't think it's cleaner code
# "CPY", # If we ever wanted to enforce copyright notice on each file
"ISC",
"ICN",
"T",
"UP",
"YTT",
# "ANN", # flake8-annotations -- looks like mypy already covers this?
"S",
# "BLE", # blind-except -- already pylint does this and we got ignores where needed
# "FBT", # FBT -- not sure I agree with the concept of boolean trap
"A",
"Q", # configured for our quoting style
"ERA",
"PGH",
"RET",
"SIM",
"SLOT",
# "FA", # We do not target older python versions
# "SLF", # Private member access -- we unfortunately do that some times
# "TD", # this is just to detect todos
# "FIX", # this is just to detect todos
# "TID", # tidy-imports -- we use relative imports from parent in some cases. Maybe stop?
# "ARG", # flake8-unused-arguments -- pylint already does this and we got ignores where needed
"PL", # all pylint rules
"PIE",
"PYI",
"COM",
"DTZ",
"EXE",
"INP",
"PT",
"TCH",
# "PTH", # Should do it at some point. Many hits and no autofix. When enabled fully remove from extend-select
"INT",
"TRY",
"FLY",
"PERF",
"FURB",
"RSE",
"LOG",
"RUF",
]
extend-select = [
"Q002", # Single quote docstring found but double quotes preferred
"Q003", # Change outer quotes to avoid escaping inner quotes
# Some pathlib enforcement rules follow
"PTH108",
"PTH109",
]
ignore = [
"B028", # no explicit stack level argument for warnings. Is fine due to the way we use them for now
"E402", # module level import at file top. https://www.flake8rules.com/rules/E402.html
"N818", # error suffix in exception names
"C901", # function too complex
"RUF001", # AmbiguousUnicodeCharacterString
"RUF002", # AmbiguousUnicodeCharacterDocstring
"RUF005", # Unpacking over concatenation -> https://github.com/charliermarsh/ruff/issues/2054#issuecomment-1399617413
"RET501", # Explicitly returning None
"RET504", # Unnecessary variable assignment before `return
"RET505", # https://github.com/charliermarsh/ruff/issues/1035
"RET506", # https://github.com/charliermarsh/ruff/issues/1035
"RET507", # https://github.com/charliermarsh/ruff/issues/1035
"RET508", # https://github.com/charliermarsh/ruff/issues/1035
"PGH003", # we do use blanket type: ignore. Perhaps can fix in the future
"SIM108", # we do use ternary operator when it makes sense. But forcing it everywhere makes the code unreadable.
"PLR2004", # we try to use constant vars where possible but this complains abouttoo many things
"PLR0904", # too many public methods. This is a bit too much to enforce in the codebase
"PLR0913", # too many arguments to function call. This is a bit too much to enforce in the codebase
"PLR0914", # too many local variables. This is a bit too much to enforce in the codebase
"PLR0915", # too many statements -- we probably could use this ... but with custom statements number?
"PLR0916", # too many boolean expressions -- we dont care
"PLR0911", # too many return statements -- we dont care
"PLR0912", # too many branches -- we dont care
"PLR0917", # too many positional arguments -- we dont care
"PLR1702", # too many nested blocks -- we dont care
"PLR6201", # Doesn't work only for constants: https://github.com/astral-sh/ruff/issues/8322
"PLR6301", # could be a staticmethod or function -- breaks for interfaces
"PLC0415", # we need to fix non top level imports and enable this
"PLC1901", # we prefer direct comparison to empty string for explicitness
"PLC2701", # unfortunately we do import private methods/vars from web3.py and webargs
"PLC2801", # false positive complain for dunder set (though we use it in a hacky way)
# Some bandit rules we don't check for
"S101", # asserts are fine
"S103", # permissive mask on file/directory
"S105", # hard coded password checks got false positives
"S106", # hard coded password checks got false positives
"S311", # We know pseudo-random is not safe for cryptographic operations
"S324", # insecure hash function. We use it for image md5 for etag. TODO: Change and enable?
"S608", # possible sql-injection is overkill since we control the variables in question
"G004", # Our logs do use f-strings everywhere at least for now
# Some pytest-styles rules we don't check for
"PT011", # pytest.raises() too broad is fine, since there is functions that raise ValueError
"PT018", # composite assertions are fine
"TRY003", # long messages outside the exception class. Perhaps enable when we do internationalization and need to put messages in class logic?
"TRY004", # Prefer TypeError for wrong type. May be okay but would need to invetigate all usages of suggested changes
"TRY301", # Abstract raise to an inner function -- not sure what this? Use exception for control flow?
"TRY400", # logging.exception instead of logging.error. Not sure I understood this one
]
[tool.ruff.lint.flake8-quotes]
avoid-escape = true
docstring-quotes = "double"
inline-quotes = "single"
multiline-quotes = "double"
[tool.ruff.lint.per-file-ignores]
"tools/*" = [
"T201", # got prints in tools
"INP001", # no need for __init__ in tools
]
"rotkehlchen/__main__.py" = ["T201"] # got prints in main
"rotkehlchen/api/server.py" = ["T201"] # got prints in server.py
"rotkehlchen/args.py" = ["T201"] # got prints in args.py
"rotkehlchen/db/minimized_schema.py" = [
"E501", # huge lines there
"Q000", # double quoted strings needed here
]
"rotkehlchen/globaldb/minimized_schema.py" = [
"E501", # huge lines there
"Q000", # double quoted strings needed here
]
"rotkehlchen/tests/*" = [
"S113", # tests have no timeout in requests
"RUF018", # We have assignments in assert in tests and that's fine there
]
"rotkehlchen/tests/conftest.py" = [
"S602", # test setup. No problem with shell=True
"S605", # test setup, can't inject in process
"S607", # test setup, partial path does not mater
]
"rotkehlchen/tests/integration/test_backend.py" = [
"S603", # test called by us. No variable input
"S607", # test called by us. Partial executable path is fine.
]
"setup.py" = ["INP001"] # no need for __init__ here
"package.py" = [
"INP001", # no need for __init__ here
"S602", # script called by us only when packaging. No problem with shell=True
"S607", # script called by us only when packaging. No problem with partial path
]
"tools/scripts/pylint_useless_suppression.py" = [
"S603", # Script called by us. No variable input
"S607", # Script called by us. Partial executable path is fine.
]
# -- isort config section --
[tool.isort]
line_length = 99
known_future_library = "future"
multi_line_output = "3"
known_first_party = ["rotkehlchen"]
include_trailing_comma = "1"
default_section = "THIRDPARTY"
combine_as_imports = "1"
[tool.vulture]
ignore_names = ["fixture_*", "*Accountant", "*Decoder"]
sort_by_size = true