-
Notifications
You must be signed in to change notification settings - Fork 9
/
pyproject.toml
308 lines (272 loc) · 9.37 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
[tool.ruff]
lint.select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"COM", # flake8-commas
"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle error
"TD", # flake8-todos
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # pylint convention
"PLE", # pylint error
"PLR", # pylint refactor
"PLW", # pylint warning
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warning
"YTT", # flake8-2020
# Interesting, should perhaps turn on later:
# "PTH", # flake8-use-pathlib
# "FLY", # flynt
# Intentionally omitted:
# "Q", # flake8-quotes -- we let the formatter handle quotes.
# "FBT", # flake8-boolean-trap -- I'm fine with boolean traps
# "ERA", # eradicate -- has tons of false-positives on commented "code"
# "EM", # flake8-errmsg -- I'm fine with strings directly in exceptions
# "PD", # pandas-vet -- I don't use pandas
# "NPY", # NumPy-specific rules -- I don't use numpy
]
lint.ignore = [
# Specific rules ignored from checkers I otherwise view as valuable:
"ANN001", # Type annotations are knowingly incomplete.
"ANN002", # Type annotations are knowingly incomplete.
"ANN003", # Type annotations are knowingly incomplete.
"ANN101", # Type annotations are knowingly incomplete.
"ANN102", # Type annotations are knowingly incomplete.
"ANN201", # Type annotations are knowingly incomplete.
"ANN202", # Type annotations are knowingly incomplete.
"ANN204", # Type annotations are knowingly incomplete.
"ANN205", # Type annotations are knowingly incomplete.
"ANN401", # Type annotations are knowingly incomplete.
"ARG001", # Unused arguments are common when inheriting with `*args, **kwargs`.
"ARG002", # Unused arguments are common when inheriting with `*args, **kwargs`.
"D100", # Not all public classes need docstrings.
"D101", # Not all public classes need docstrings.
"D102", # Not all public methods need docstrings.
"D103", # Not all public methods need docstrings.
"D104", # Not all packages need docstrings.
"D105", # Not all magic methods need docstrings.
"D106", # Not all public classes need docstrings.
"D107", # Not all `__init__` methods need docstrings.
"D400", # I don't care if summary lines are sentences
"D401", # I don't care how summary lines are conjugated
"D415", # I don't care if summary lines are sentences
"N806", # Function arguments are frequently uppercase in migrations.
"PLR2004", # Tests & simple logic extensively use "magic values"
"PT009", # I intentionally use `unittest`-style tests.
"PT019", # I don't use pytest fixtures.
"PT027", # I don't use pytest.raises
"S101", # Using `assert` is fine (I run with them enabled).
"S311", # I use RNGs but they're not for cryptography purposes.
"SIM117", # Multiple `with` statements can aid readability
"TD002", # This is a solo project -- I authored all the TODOs.
"TD003", # This is a solo project -- I don't track issues.
"TRY003", # I don't mind specifying messages in the exception raise.
# Errors which I'll plan to fix soon:
"DJ001", # Avoid nullable charfields
"RUF012", # I should make better use of ClassVar and Final
# Errors that conflict with `ruff format`
"ISC001",
"COM812", # Formatter manages commas.
"E501", # Formatter manages line length.
# Errors that conflict with *other* rules in their own ruleset
"D213", # Method summaries can go on the first line (conflicts with D212)
"D203", # No blank line before class (conflicts with D211)
]
# By default, `ruff` will respect `.gitignore`
# However, we can/should be explicit about excluded directories for CI
exclude = [
".venv/",
"node_modules/",
"static/",
]
lint.fixable = ["ALL"]
lint.unfixable = []
[tool.ruff.lint.flake8-self]
ignore-names = [
"_asdict",
"_replace",
"_fields",
"_meta",
]
[project]
# When poetry full supports PEP 621, should migrate more information here!
# See: https://github.com/python-poetry/roadmap/issues/3
name = "ws"
requires-python = "~=3.10" # Keep in sync with Poetry
[tool.poetry]
name = "ws"
version = "0.1.0"
description = "The MIT Outing Club's trip management system"
license = "GPL-3.0"
readme = "README.md"
homepage = "https://mitoc-trips.mit.edu"
repository = "https://github.com/DavidCain/mitoc-trips/"
authors = ["David Cain <davidjosephcain@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.10.0"
[tool.poetry.group.prod.dependencies]
Django = "^4.2"
PyJWT = ">= 2.0.0" # 2.0.0 changed the return type of `jwt.encode()`
beautifulsoup4 = "*"
celery = "^5.1"
django-allauth= { version = "*", extras=["socialaccount"] }
django-cors-headers = "*"
django-crispy-forms = "^1.12.0"
django-phonenumber-field = { version = ">= 2.0", extras = ["phonenumberslite"] }
django-pipeline = "*" # TODO: To eventually be replaced by webpack-loader
django-smtp-ssl = "*"
django-webpack-loader = "^1.1.0" # Should maintain parity with frontend/package.json
gunicorn = "^22.0.0" # Used to run production worker
markdown2 = "*"
mitoc-const = "^1.0.0" # (1.0.0 includes type hints)
phonenumberslite = "*"
psycopg2 = "*"
pwned-passwords-django = "*"
requests = "*"
sentry-sdk = "^1.30.0"
setuptools = "^69.5.1" # Required by django-pipeline in prod!
typing-extensions = "^4.11.0" # Can remove after Python 3.11
[tool.poetry.group.test.dependencies]
coverage = { version = "*" }
factory_boy = "*"
freezegun = "*"
lxml = "*"
pytest = "*"
pytest-django = "*"
pytest-socket = "*"
responses = "*"
[tool.poetry.group.lint]
optional = true
[tool.poetry.group.lint.dependencies]
pylint = "^3.0"
ruff = "*"
[tool.poetry.group.mypy]
optional = true
[tool.poetry.group.mypy.dependencies]
celery-types = "^0.19.0"
django-stubs = { version = "==5.0.2" } # Temporarily pin for QuerySet issue
mypy = { version = "*"}
types-certifi = { version = "*" }
types-cryptography = { version = "*" }
types-requests = { version = "*" }
# Dependencies helpful for local development, not used otherwise
[tool.poetry.group.localdev]
optional = true
[tool.poetry.group.localdev.dependencies]
django-debug-toolbar = { version = "*" }
ipdb = { version = "*" }
[tool.mypy]
python_version = "3.10"
plugins = ["mypy_django_plugin.main"]
# Better errors
pretty = true
show_error_codes = true
show_column_numbers = true
# Default into *all* strict settings
strict = true
# Strict settings we cannot yet turn on
check_untyped_defs = false
disallow_any_generics = false
disallow_subclassing_any = false
disallow_untyped_defs = false
[[tool.mypy.overrides]]
# Explicitly ignore imports that do not have type hints or library stubs
# Periodically, it's worth checking in to see which of these may have types later!
# (After dropping support for Python versions before 3.5, it's easy to just type annotate directly
module = [
"allauth.*",
"bs4",
"celery.*",
"debug_toolbar",
"factory.*",
"freezegun",
"kombu.*",
"localflavor.*",
"markdown2",
"phonenumber_field.*",
"phonenumbers",
"pipeline.*",
"pwned_passwords_django.*",
]
ignore_missing_imports = true
[tool.django-stubs]
django_settings_module = "ws.settings"
[tool.pylint.'MESSAGES CONTROL']
disable = [
"format", # We use the ruff autoformatter
"arguments-differ",
"fixme",
"invalid-name",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
"too-many-public-methods",
################################
# I might remove some of these #
################################
"attribute-defined-outside-init",
"duplicate-code",
"no-member",
"too-many-locals",
############################
# I aspire to remove these #
############################
"missing-docstring",
"unused-argument", # Currently quite common in method strings
####################################
# We let ruff handle these instead #
####################################
"consider-using-in",
"logging-fstring-interpolation",
"protected-access",
"raise-missing-from",
"ungrouped-imports",
"wrong-import-order",
"wrong-import-position",
]
[tool.pylint.REPORTS]
reports = false
score = false
[tool.pylint.FORMAT]
max-module-lines = 2000
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "ws.settings"
filterwarnings = [
"error",
# This is issued by `django-pipeline`, itself deprecated
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
# If we don't set this deprecated setting, django-pipeline won't make bundles
"ignore:The STATICFILES_STORAGE setting is deprecated",
]