-
Notifications
You must be signed in to change notification settings - Fork 6
/
pyproject.toml
136 lines (122 loc) · 4.67 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
[tool.poetry]
name = "my-itmo-ru-to-ical"
version = "1.1.0"
description = "A simple app exporting the scheudle from my.itmo.ru in iCalendar format."
authors = ["iburakov <speedwatson@gmail.com>"]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.11"
ics = "^0.7.2"
Flask = {extras = ["async"], version = "^2.3.3"}
sentry-sdk = {extras = ["flask"], version = "^1.4.3"}
aiohttp = "^3.8.5"
async-cache = "^1.1.1"
[tool.poetry.group.dev.dependencies]
ruff = "^0.0.291"
black = "^23.9.1"
mypy = "^1.5.1"
vulture = "^2.9.1"
types-requests = "^2.31.0.3"
types-python-dateutil = "^2.8.19.14"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.black]
line-length = 120
[tool.mypy]
files = ["src"]
[[tool.mypy.overrides]]
# https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
# it's better to disable untyped modules on a per-module basis
module = ["ics.*", "cache.*"]
ignore_missing_imports = true
[tool.ruff]
line-length = 120
select = [
# A set of chosen linter rules is specified here.
# See https://beta.ruff.rs/docs/rules/ for more info.
# pyflakes (simple obvious errors)
"F",
# pycodestyle (style linter, pep8, black-compatible)
"E",
"W",
# pep8-naming (style linter, pep8 naming conventions)
"N",
# isort (imports sorting)
"I",
# mccabe (cyclomatic complexity analyzer to prevent overcomplicated functions)
"C90",
# pyupgrade (possible syntax upgrades checker)
"UP",
# eradicate (commented-out code finder for it to be removed)
"ERA",
# flake8-2020 (errors related to sys.version or sys.version_info, just in case)
"YTT",
# flake8-async (async-related mistakes/errors)
"ASYNC",
# flake8-builtins (checks builtin names shadowing, it's better not to)
"A",
# flake8-commas (to enforce trailing commas)
"COM",
# flake8-future-annotations (to ensure enabling modern (3.7+) postponed evaluation of type hints)
"FA",
# flake8-import-conventions (to enforce standartized import aliases like "import pandas as pd")
"ICN",
# flake8-no-pep420 (to enforce presence of __init__.py in packages)
"INP",
# flake8-print (to disallow print statements)
"T20",
# flake8-pytest-style (to improve pytest-related style consistency)
"PT",
# flake8-quotes (to enforce quotes style)
"Q",
# flake8-return (checks mistakes related to return values)
"RET",
# flake8-use-pathlib (to enforce pathlib usage instead of os.path)
"PTH",
# tryceratops (try/except-related advices)
"TRY",
# ruff-specific advices
"RUF",
]
ignore = [
"E501", # allow lines longer than 80 symbols (up to 120)
"RET504", # allow "unnecessary" assignments before return statements as it's often useful for chaning data transformations
"TRY003", # allow something like raise ValueError(f"Formatting {this} error message on the spot here"). too strict!
]
unfixable = [
"ERA001", # prohibit to "auto-fix" (=remove) commented-out code
]
src = ["src"]
[tool.ruff.mccabe]
max-complexity = 7
[tool.vulture]
# Vulture is a tool that statically finds unreachable code or unused attributes in Python programs.
# Doing it without running the code in a language as dynamic as Python is non-trivial.
# Hence, Vulture has some notion of "confidence", but imho it's pretty weird, since obvious unused global functions are
# given 60% confidence anyway just because they're functions (I guess?). Confidence depends on object's type, among other things.
min_confidence = 60
# 60% confidence threshold yields a lot of false positives, but 70% threshold yields a lot of false negatives.
# The only way to get a good result is to use a 60% with a whitelist, adding false positives to it as they appear:
# 1) Initialize a whitelist (once per project):
# $ vulture --make-whitelist > vulture_whitelist.txt
# 2) During development, run vulture and review the results. This config in pyproject.toml is picked up, so
# vulture_whitelist.txt is picked up too (it's specified in the `paths` below) and false positives are ignored:
# $ vulture
# 3) When all the new true positives are fixed, add remaining false positives to the whitelist:
# $ vulture --make-whitelist >> vulture_whitelist.txt
# 4) Keep in mind that if some false positives tend to appear again (like FastAPI's `@app`-decorated functions),
# they better be added to the ignore list below, not to the whitelist.
paths = ["src", "vulture_whitelist.txt"]
ignore_decorators = [
# FastAPI, Flask
"@app.route",
"@app.exception_handler",
"@app.get",
"@app.post",
"@app.put",
"@app.delete",
"@app.patch",
]
ignore_names = []
sort_by_size = true