-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
234 lines (200 loc) · 6.59 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
[project]
name = "missil"
version = "0.1.0"
description = "Simple FastAPI declarative endpoint-level access control."
authors = [{ name = "Eric Miguel", email = "[email protected]" }]
classifiers = [
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development",
"Typing :: Typed",
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: AsyncIO",
"Framework :: FastAPI",
"Framework :: Pydantic",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
]
dependencies = ["fastapi>=0.104.1", "python-jose[cryptography]>=3.3.0"]
requires-python = ">=3.10"
readme = "README.md"
license = { text = "MIT" }
[tool.mypy]
check_untyped_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
show_error_codes = true
warn_return_any = true
[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(message)s"
log_file = "pytest.log"
log_file_level = "INFO"
log_file_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
[tool.ruff]
# Enable fix behavior by-default when running ruff
# (overridden by the --fix and --no-fix command-line flags).
# Only includes automatic fixes unless --unsafe-fixes is provided.
fix = true
include = ["pyproject.toml", "src/**/*.py", "scripts/**/*.py", "*.py"]
extend-include = ["*.ipynb"]
respect-gitignore = true
show-fixes = true
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 88
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[tool.ruff.lint]
# Allows removing unused imports at __init__ files
ignore-init-module-imports = false
extend-safe-fixes = ["F401"]
# Enable Pyflakes (`F`) and pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
# Enable flake8-bugbear (`B`) rules, in addition to the defaults.
# Enable docs (`D`) and imperative doc mood (D401) rules.
# Enable import sorting (isort) (`I`) rules.
select = ["F", "E", "W", "C901", "B", "D", "D401", "E", "I001"]
# Avoid enforcing line-length violations (`E501`)
# Relax the convention by _not_ requiring documentation for every function parameter.
ignore = [
"D417",
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
# 3. Avoid trying to fix flake8-bugbear (`B`) violations.
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = true
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.pydocstyle]
convention = "numpy" # Accepts: "google", "numpy", or "pep257".
[tool.ruff.lint.flake8-bandit]
check-typed-exception = true
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "single"
[tool.ruff.lint.flake8-import-conventions.aliases]
# Declare the default aliases.
altair = "alt"
"matplotlib.pyplot" = "plt"
numpy = "np"
pandas = "pd"
seaborn = "sns"
scipy = "sp"
polars = "pl"
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
# Declare a custom alias for the `matplotlib` module.
"dask.dataframe" = "dd"
[tool.ruff.lint.isort]
# Forces all from imports to appear on their own line.
force-single-line = true
# Don't sort straight-style imports (like import sys) before from-style imports
# (like from itertools import groupby). Instead, sort the imports by module,
# independent of import style.
force-sort-within-sections = true
# Use a single line after each import block.
lines-after-imports = 2
# Use no lines between direct and from import.
lines-between-types = 0
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D100", "D103", "D104"]
[tool.pdm.dev-dependencies]
dev = [
"mypy>=1.4.1",
"pre-commit>=3.4.0",
"pytest>=7.4.4",
"pytest-cov>=4.1.0",
"pytest-cookies>=0.7.0",
"httpx>=0.26.0",
"uvicorn>=0.26.0",
"types-python-jose>=3.3.4.20240106",
"pre-commit>=3.6.0",
"mkdocs-material>=9.5.4",
"mkdocstrings[python]>=0.24.0",
"mkdocs>=1.5.3",
"termynal>=0.11.1",
"ruff>=0.4.3",
"vulture>=2.11",
]
[tool.pdm.scripts]
format = { shell = "ruff format" }
check = { shell = "ruff check" }
check-dry-run = { shell = "ruff check --no-fix" }
check-dead = { shell = "vulture missil --min-confidence=90" }
check-dead-lax = { shell = "vulture missil --min-confidence=80" }
check-dead-sensible = { shell = "vulture missil --min-confidence=60"}
check-typing = { shell = "mypy missil" }
test = { shell = "pytest --cov=missil tests/" }
lint = { composite = ["check || true", "check-dead || true", "check-typing || true"] }
fix = { composite = ["format || true"] }
lint-fix = { composite = ["lint || true" ,"fix || true"] }
lint-fix-test = { cmd = ["pre-commit", "run", "--all-files"] }
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"