-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpyproject.toml
192 lines (167 loc) · 5.49 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
[tool.poetry]
name = "sqs-workers"
version = "0.5.21"
description = "An opinionated queue processor for Amazon SQS"
authors = ["Doist Developers <[email protected]>"]
license = "MIT"
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"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",
]
homepage = "https://github.com/Doist/sqs-workers"
readme = "README.md"
exclude = ['tests/']
[tool.poetry.dependencies]
python = "^3.8,<3.13"
boto3 = "^1.24.62"
attrs = "^23.1.0"
[tool.poetry.dev-dependencies]
pytest-runner = "^6.0.0"
pytest = "^8.1.1"
localstack-client = "^1.7"
pre-commit = "^2.20.0"
ruff = "^0.5.1"
tox = "^4.15.1"
typing-extensions = "^4.0.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
select = [
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"D", # pydocstyle,
"E", "W", # pycodestyle
"F", # pyflakes
"I", # isort
"PL", # pylint
"RUF", # ruff
"S", # flake8-bandit
"SIM", # flake8-simplify
"UP", # pyupgrade
]
# By default, always show source code snippets.
show-source = true
ignore = [
## D - pydocstyle ##
# D1XX errors are OK. Don't force people into over-documenting.
"D100", "D101", "D102", "D103", "D104", "D105", "D107",
# These need to be fixed.
"D202", "D205", "D400", "D401",
## E / W - pycodestyle ##
"E501", # line too long
"E203", # whitespace-before-punctuation
"E741", # ambiguous variable name
## PL - pylint ##
# Commented-out rules are rules that we disable in pylint but are not supported by ruff yet.
# Import order issues
# "PLC0411", # wrong-import-order
# "PLC0412", # wrong-import-position
"PLC0414", # ungrouped-imports
# Documentation issues
# "C0114", # missing-module-docstring
# Complexity issues
# "PLR0904", # too-many-public-methods
# "PLC0302", # too-many-lines
# "PLR1702", # too-many-nested-blocks
# "PLR0902", # too-many-instance-attributes
"PLR0911", # too-many-return-statements
"PLR0915", # too-many-statements
"PLR0912", # too-many-branches
# "PLR0903", # too-few-public-methods
# "PLR0914", # too-many-locals
# "PLC0301", # line-too-long
"PLR0913", # too-many-arguments
"PLR2004", # magic-value-comparison
"PLR5501", # collapsible-else-if
"PLW0603", # global-statement
"PLW2901", # redefined-loop-name
"PLC1901", # compare-to-empty-string
## RUF - ruff ##
"RUF001", # ambiguous-unicode-character-string
"RUF002", # ambiguous-unicode-character-docstring
"RUF003", # ambiguous-unicode-character-comment
"RUF012", # mutable-class-default
# Enable when Poetry supports PEP 621 and we migrate our confguration to it.
# See: https://github.com/python-poetry/poetry-core/pull/567
"RUF200",
"S101", # assert
"S104", # hardcoded-bind-all-interfaces
"S105", # hardcoded-password-string
"S106", # hardcoded-password-func-arg
"S107", # hardcoded-password-default
"S110", # try-except-pass
"S301", # suspicious-pickle-usage
"S303", # suspicious-insecure-hash-usage
"S310", # suspicious-url-open-usage
"S311", # suspicious-non-cryptographic-random-usage
"S324", # hashlib-insecure-hash-function
"S603", # subprocess-without-shell-equals-true
"S607", # start-process-with-partial-path
"S608", # hardcoded-sql-expression
## SIM - flake8-simplify ##
"SIM102", # collapsible-if
"SIM105", # suppressible-exception
"SIM108", # if-else-block-instead-of-if-exp
"SIM114", # if-with-same-arms
"SIM116", # if-else-block-instead-of-dict-lookup
"SIM117", # multiple-with-statements
# Enable when the rule is out of preview and false-positives are handled.
# See: https://docs.astral.sh/ruff/rules/in-dict-keys/
"SIM118", # in-dict-keys
]
extend-exclude = [
"env",
"runtime",
]
[tool.ruff.per-file-ignores]
# These files have only a bunch of imports in them to force code loading.
"todoist/workers/todoist_handlers.py" = ["F401"]
"todoist/signals/signal_handlers.py" = ["F401"]
"todoist/workers/scripts_handlers.py" = ["F401"]
"scripts/**" = ["S101"] # Allow assert statement in scripts.
"tests/**" = ["S101"] # Allow assert statement in tests.
# We allow module-level imports to be not at the top of scripts, cron,
# and configs because we initialize Todoist environment there
"todoist/*/scripts/*.py" = ["E402"]
"todoist/*/cron/*.py" = ["E402"]
"scripts/*.py" = ["E402"]
"configs/*.py" = ["E402"]
# To import all fixtures from other conftests.
"conftest.py" = ["F401", "F403"]
# To import select fixtures from non-local conftests.
# Importing and using the fixture makes it be shadowed.
"test_*.py" = ["F401", "F811"]
"tests/minimal/conftest.py" = [
"E402",
"F401",
"F403",
]
[tool.ruff.isort]
section-order = [
"future",
"standard-library",
"third-party",
"parts",
"first-party",
"td-models",
"td-apps",
"local-folder",
]
[tool.ruff.isort.sections]
"parts" = ["parts"]
"td-models" = ["todoist.models"]
"td-apps" = ["todoist.apps"]
[tool.ruff.pydocstyle]
convention = "pep257"
[tool.ruff.lint.pyupgrade]
# Required by tools like Pydantic that use type information at runtime.
# https://github.com/asottile/pyupgrade/issues/622#issuecomment-1088766572
keep-runtime-typing = true