-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
225 lines (210 loc) · 7.03 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
[build-system]
requires = ["poetry-core>=1.0.0,<2.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "rev-engine"
version = "0.1.0"
description = ""
authors = ["Caktus Group, LLC <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.10"
Pillow = "^10.1.0"
addict = "^2.4.0"
backoff = "^2.2.1"
celery = "^5, !=5.3.x" # skip v5.3 and go directly to v5.4 when released (~mid march 2024)
cloudflare = "^2"
colorama = "0.4.6"
dateparser = "^1.2.0"
dj-database-url = "^1.2.0"
django = "^4"
django-celery-beat = "^2.4.0"
django-csp = "^3.7"
django-extensions = "^3.2.1"
django-filter = "^22.1"
django-health-check = "^3.16.4"
django-json-widget = "^2.0.1"
django-migration-linter = "^4.1.0"
django-model-utils = "^4.3.1"
django-redis = "^5"
django-request-id = "^1.0.0"
django-rest-passwordreset = "^1.2.1"
django-reverse-admin = "^2.9.6"
django-reversion = "^5.0.0"
django-reversion-compare = "^0.15.0"
django-solo = "^2.0.0"
django-storages = "^1.13.2"
django-test-migrations = "^1.2.0"
django-waffle = "^2.4.1"
djangorestframework = "^3.12.4"
djangorestframework-simplejwt = "^5.3.1"
drf-extra-fields = "^3"
google-auth = "^2.12"
google-cloud-pubsub = "^2.13"
google-cloud-secret-manager = "^2.16.0"
google-cloud-storage = "^2.4.0"
heroku3 = "^5"
invoke = "2.2.0"
mailchimp-marketing = "^3.0.80"
newrelic = "^8.4.0"
phonenumbers = "^8.13.34"
psycopg2-binary = "^2"
pycountry = "^22.3.5"
pydantic = "^2.2.0"
pygments = "^2.13.0"
python3-memcached= "^1"
requests = "^2"
sentry-sdk = "^2.8.0"
slack-sdk = "^3"
sorl-thumbnail = "^12.7.0"
sorl-thumbnail-serializer-field = "^0.2.1"
stripe = "^4"
tldextract = "^5.1.1"
uwsgi = "^2"
uwsgitop = "^0.11"
whitenoise = "^6.2.0"
django-rest-knox = "^5.0.2"
[tool.poetry.dev-dependencies]
Faker = "*"
appnope = "*" # disabling App Nap on macOS >= 10.9
bandit = "*"
beautifulsoup4 = "*"
black = "*"
coverage = "*"
django-debug-toolbar = "*"
drf-yasg = "*" # Swagger generator
factory_boy = "*"
ipython = "*"
pre-commit = "*"
pytest = "^7" # temporarily pinned due to pytest-asyncio not support pytest 8 https://github.com/pytest-dev/pytest-asyncio/issues/737
pytest-celery = "^0"
pytest-cov = "*"
pytest-django = "*"
pytest-mock = "*"
pytest-ruff = "*"
pytest-xdist = "*"
pyyaml = "*"
responses = "*" # mocking out the requests library
ruff = "*"
[tool.poetry.extras]
bandit = ["toml"]
[tool.pytest.ini_options]
addopts = "--ruff --reuse-db -p no:warnings"
#norecursedirs = ".cache .git .github .pytest_cache .ruff_cache .venv __pycache__ dist build htmlcov test_data"
DJANGO_SETTINGS_MODULE = "revengine.settings.local"
testpaths = ["apps", "revengine"]
python_files = ["tests.py", "test_*.py", "*_tests.py"]
[tool.bandit]
targets = ["./apps", "./revengine", "./scripts"]
exclude_dirs = ["tests", ".*"]
[tool.black]
line-length = 120
target-version = ["py310"]
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| build
| dist
| env
| htmlcov
| node_modules
| public
| venv
)/
'''
[tool.ruff]
line-length = 140
target-version = "py310"
include = ["*py", "apps/*py", "revengine/*py", "scripts/*py"]
[tool.ruff.format]
quote-style = "double"
[tool.ruff.lint.per-file-ignores]
"revengine/settings/*py" = ["F405"] # star import
"*/migrations/*py" = ["F401", "E501"] # unused import, line too long
# S - bandit checks N/A to test code
# RUF018 Avoid assignment expressions in `assert` statements - N/A to test code
"*/tests/*py" = ["S", "RUF018"]
"*/tests.py" = ["S", "RUF018"]
"conftest.py" = ["S", "RUF018"]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ["typer.Option", ]
[tool.ruff.lint.isort]
section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder"]
lines-after-imports = 2
[tool.ruff.lint.isort.sections]
"django" = ["django", "django.*"]
[tool.ruff.lint.mccabe]
max-complexity = 12 # .flake8 set to 18, extremely high, 10 is default. 12 was highest existing complexity.
# TODO @njh: reduce complexity to 10 or less
# apps/organizations/views.py:281:5: C901 `handle_stripe_account_link` is too complex (12 > 10)
# apps/users/forms.py:14:9: C901 `clean` is too complex (12 > 10)
[tool.ruff.lint]
ignore = [
"D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107", # Missing docstring (too much effort)
"D203", # Incompatable with D211 (pick one or other)
"D213", # Incompatable with D212 (pick one or other)
"E731", # Do not assign a lambda expression, use a def (no)
"PERF203", # try/except in loop incurs performance penalty (ok, but sometimes it's necessary)
"RET503", # No explicit return (the other RET rules are about removing superflous code such as this)
"S105", # Hardcoded passwords (too many false positives)
"SIM108", # Use ternary operator (only when it's more readable)
"TRY003", # Avoid long messages outside exception class (no)
"COM812", # Conflicts with black feature (black always splits lines with trailing comma)
# @njh we should enforce these rules
"ANN", "RUF012", "RUF013", # TODO @njh: type annotations
"DJ001", # TODO @njh: charfields should not be nullable
"PLW1508", # TODO @njh: DEV-4779 invalid type for env var
"S308", # TODO @njh: DEV-4778 use of mark_safe may expose cross-site scripting vulnerabilities
]
select = [
"A", # flake8-builtins
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C90", # mccabe
"C4", # unnecessary comprehensions, map() https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"COM", # flake8-commas
"D", # pydocstyle
"DJ", # flake8-django https://docs.astral.sh/ruff/rules/#flake8-django-dj
"DTZ", # flake8-datetimez
"E", # pycodestyle
"ERA", # No commented out code
"EXE", # flake8-executable
"F", # pyflakes
"FLY", # https://docs.astral.sh/ruff/rules/#flynt-fly
"G", # flake8-logging-format
"I", # isort
"ICN", # https://github.com/joaopalmeiro/flake8-import-conventions
"ISC", # https://pypi.org/project/flake8-implicit-str-concat/
"LOG", # flake8-logging
# "NPY", # numpy (numpy not used by project)
# "PD", # pandas (pandas not used by project)
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
"PIE", # https://pypi.org/project/flake8-pie/
"PLC", # Pylint conventions
"PLE", # Pylint error
"PLW", # Pylint warnings
"PT", # https://pypi.org/project/flake8-pytest-style/
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"Q", # flakes-quotes
"RET", # https://pypi.org/project/flake8-return/
"RUF", # Ruff rules
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"SIM", # https://pypi.org/project/flake8-simplify/
"T", # flake8-debugger
"TD", # https://github.com/orsinium-labs/flake8-todos/
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
# @njh disabled for stated ("reason")
#"ARG", # flake8 unused arguments (not helpful, unused func args are common and ok)
#"N", # pep8-naming (too opinionated)
#"PLR", # Pylint refactor (too much effort for return / too opinionated)
]