-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
221 lines (187 loc) · 6.78 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
[tool.poetry] # https://python-poetry.org/docs/pyproject/
name = "vespadb"
version = "0.0.0"
description = "monitoring vespa observations"
authors = []
license = "Proprietary"
readme = "README.md"
repository = "https://github.com/inbo/vespa-db/"
[build-system] # https://python-poetry.org/docs/pyproject/#poetry-and-pep-517
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dependencies] # https://python-poetry.org/docs/dependency-specification/
python = ">=3.11.6,<4.0"
poethepoet = ">=0.24.4"
Django = ">=5.0.2"
gunicorn = ">=21.2.0"
pydantic = ">=2.6.1"
djangorestframework = "^3.14.0"
django-filter = "^23.5"
psycopg2 = "^2.9.9"
ipython = "^8.22.1"
drf-yasg = "^1.21.7"
djangorestframework-gis = "^1.0"
pre-commit = "^3.6.2"
django-redis = "^5.4.0"
python-dotenv = "^1.0.1"
django-cors-headers = "^4.3.1"
djangorestframework-jwt = "^1.11.0"
djangorestframework-simplejwt = "^5.3.1"
geopandas = "^0.14.3"
factory-boy = "^3.2.0"
geopy = "^2.4.1"
celery = "^5.3.6"
redis = "^5.0.3"
django-celery-beat = "^2.6.0"
django-celery-results = "^2.5.1"
types-requests = "^2.31.0.20240406"
types-pytz = "^2024.1.0.20240203"
requests = "^2.31.0"
boto3 = "^1.34.92"
django-ratelimit = "^4.1.0"
types-python-dateutil = "^2.9.0.20240316"
whitenoise = "^6.6.0"
django-ses = "^4.2.0"
[tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/
coverage = { extras = ["toml"], version = ">=7.4.1" }
ipython = ">=8.20.0"
mypy = "1.8.0"
pre-commit = ">=3.6.2"
pytest = ">=8.0.1"
pytest-clarity = ">=1.0.1"
pytest-mock = ">=3.12.0"
safety = ">=2.3.5,!=2.3.5"
shellcheck-py = ">=0.9.0"
typeguard = ">=4.1.5"
ruff = "^0.2.2"
[[tool.poetry.source]] # https://python-poetry.org/docs/repositories/
name = "pypi"
priority = "primary"
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html#report
# TODO: please raise the bar :)
fail_under = 0
precision = 1
show_missing = true
skip_covered = true
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html#run
branch = true
command_line = "--module pytest"
data_file = "reports/.coverage"
source = ["vespadb"]
[tool.coverage.xml] # https://coverage.readthedocs.io/en/latest/config.html#xml
output = "reports/coverage.xml"
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html
junit_xml = "reports/mypy.xml"
plugins = "pydantic.mypy"
strict = true
disallow_subclassing_any = false
disallow_untyped_decorators = false
explicit_package_bases = true
ignore_missing_imports = true
pretty = true
show_column_numbers = true
show_error_codes = true
show_error_context = true
warn_unreachable = true
mypy_path = "src"
exclude = "^.*\b(migrations)\b.*$"
[tool.pydantic-mypy] # https://pydantic-docs.helpmanual.io/mypy_plugin/#configuring-the-plugin
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.pytest.ini_options] # https://docs.pytest.org/en/latest/reference/reference.html#ini-options-ref
addopts = "--color=yes --doctest-modules --exitfirst --failed-first --strict-config --strict-markers --typeguard-packages=vespadb --verbosity=2 --junitxml=reports/pytest.xml"
filterwarnings = ["error", "ignore::DeprecationWarning"]
testpaths = ["src", "tests"]
xfail_strict = true
log_file_level = "info"
pythonpath = "src"
[tool.ruff] # https://github.com/charliermarsh/ruff
fix = true
ignore-init-module-imports = true
line-length = 120
select = ["A", "ASYNC", "B", "BLE", "C4", "C90", "D", "DTZ", "E", "EM", "ERA", "F", "FBT", "FLY", "FURB", "G", "I", "ICN", "INP", "INT", "ISC", "LOG", "N", "NPY", "PERF", "PGH", "PIE", "PLC", "PLE", "PLR", "PLW", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "S", "SIM", "SLF", "SLOT", "T10", "T20", "TCH", "TID", "TRY", "UP", "W", "YTT"]
extend-safe-fixes = ["TID252"] # https://docs.astral.sh/ruff/settings/#extend-safe-fixes
ignore = ["FBT001", "E501", "EM101", "EM102", "ISC001", "RET504", "S101", "TRY003", "PLR0914", "TRY300", "W505", "PLR6301", "RUF012", "G004", "TRY401"]
unfixable = ["ERA001", "F401", "F841", "T201", "T203"] # https://docs.astral.sh/ruff/settings/#unfixable
src = ["src", "tests"]
target-version = "py311"
force-exclude = true # https://docs.astral.sh/ruff/settings/#force-exclude
preview = true # https://docs.astral.sh/ruff/preview/
exclude = [
"*/migrations/*",
]
[tool.ruff.extend-per-file-ignores] # https://docs.astral.sh/ruff/settings/#extend-per-file-ignores
# Ignore missing __init__.py files in tests.
"tests/*" = ["INP001", "PLR2004"]
[tool.ruff.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.ruff.mccabe]
max-complexity = 10
[tool.ruff.pep8-naming]
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
classmethod-decorators = ["classmethod", "pydantic.validator", "pydantic.root_validator"]
[tool.ruff.pycodestyle]
max-doc-length = 100
[tool.ruff.pydocstyle]
convention = "numpy"
[tool.poe.tasks] # https://poethepoet.natn.io/index.html
[tool.poe.tasks.lint]
help = "Lint this package"
[[tool.poe.tasks.lint.sequence]]
shell = '[ -d ".git" ] || { echo "\n\\033[0;31mGit is not initialized in this directory. Please run \"git init\" to fix linting.\\033[0m\n"; exit 1; }'
[[tool.poe.tasks.lint.sequence]]
cmd = """
pre-commit run
--all-files
--color always
"""
[tool.poe.tasks.safety]
help = "Run safety checks on this package"
shell = "safety check --continue-on-error --full-report"
[tool.poe.tasks.test]
help = "Test this package"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage run"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage report"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage xml"
[tool.poe.tasks.serve] # https://docs.gunicorn.org/en/stable/settings.html
help = "Serve Django App"
shell = """
if [ $dev ]
then {
django-admin \
runserver $host:$port \
--settings=vespadb.settings
} else {
gunicorn \
--bind=$host:$port \
'vespadb.wsgi'
} fi
"""
[[tool.poe.tasks.serve.args]]
help = "Bind socket to this host (default: 0.0.0.0)"
name = "host"
options = ["--host"]
default = "0.0.0.0"
[[tool.poe.tasks.serve.args]]
help = "Bind socket to this port (default: 8000)"
name = "port"
options = ["--port"]
default = "8000"
[[tool.poe.tasks.serve.args]]
help = "Enable development mode"
type = "boolean"
name = "dev"
options = ["--dev"]
[tool.poe.tasks.celery-worker]
help = "Run the Celery worker"
cmd = "celery -A vespadb worker --loglevel=info"
# Add Celery beat task
[tool.poe.tasks.celery-beat]
help = "Run the Celery beat scheduler"
cmd = "celery -A vespadb beat --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler"