-
Notifications
You must be signed in to change notification settings - Fork 30
/
pyproject.toml
282 lines (257 loc) · 8.84 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
[project]
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
name = "giftless"
description = "A Git LFS Server implementation in Python with support for pluggable backends"
license = {file = "LICENSE"}
readme = "README.md"
keywords = [
"git",
"git-lfs",
"datopian",
]
# https://pypi.org/classifiers/
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved:: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Natural Language :: English",
"Operating System :: POSIX",
"Typing :: Typed",
]
requires-python = ">=3.10"
dependencies = []
dynamic = ["version"]
[[project.authors]]
name="Shahar Evron"
email="[email protected]"
[[project.authors]]
name="Rufus Pollock"
email="[email protected]"
[[project.authors]]
name="Adam Thornton"
email="[email protected]"
[project.urls]
Homepage = "https://giftless.datopian.com"
Source = "https://github.com/datopian/giftless"
"Issue tracker" = "https://github.com/datopian/giftless/issues"
[build-system]
requires = [
"setuptools>=61",
"wheel",
"setuptools_scm[toml]>=6.2",
]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
# Use single-quoted strings so TOML treats the string like a Python r-string
# Multi-line strings are implicitly treated by black as regular expressions
[tool.setuptools.packages.find]
include = ["giftless"]
[tool.coverage.run]
parallel = true
branch = true
source = ["giftless"]
[tool.coverage.paths]
source = ["giftless", ".tox/*/site-packages"]
[tool.coverage.report]
show_missing = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:"
]
[tool.mypy]
disallow_untyped_defs = true
disallow_incomplete_defs = true
ignore_missing_imports = true
local_partial_types = true
namespace_packages = true
no_implicit_reexport = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
module = [
"flask_classful",
"webargs"
]
ignore_missing_imports = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.pytest.ini_options]
testpaths = [
"tests"
]
env = [
"D:AZURE_CONNECTION_STRING=",
"D:AZURE_CONTAINER=",
"D:GCP_BUCKET_NAME=",
"D:GCP_PROJECT_NAME=",
"D:GCP_ACCOUNT_KEY_FILE=",
]
addopts = [
"--doctest-modules"
]
filterwarnings = [
# Google modules call a deprecated pkg_resources API.
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
"ignore:.*pkg_resources\\.declare_namespace:DeprecationWarning",
# Bug in kopf
"ignore:.*require all values to be sortable:DeprecationWarning:kopf.*",
# Our warnings towards users
"ignore::FutureWarning",
]
# The python_files setting is not for test detection (pytest will pick up any
# test files named *_test.py without this setting) but to enable special
# assert processing in any non-test supporting files under tests. We
# conventionally put test support functions under tests.support and may
# sometimes use assert in test fixtures in conftest.py, and pytest only
# enables magical assert processing (showing a full diff on assert failures
# with complex data structures rather than only the assert message) in files
# listed in python_files.
python_files = [
"tests/*.py",
"tests/*/*.py"
]
# The rule used with Ruff configuration is to disable every lint that has
# legitimate exceptions that are not dodgy code, rather than cluttering code
# with noqa markers. This is therefore a reiatively relaxed configuration that
# errs on the side of disabling legitimate lints.
#
# Reference for settings: https://docs.astral.sh/ruff/settings/
# Reference for rules: https://docs.astral.sh/ruff/rules/
[tool.ruff]
exclude = [
"docs/source/conf.py",
]
line-length = 79
ignore = [
"ANN101", # self should not have a type annotation
"ANN102", # cls should not have a type annotation
"ANN401", # sometimes Any is the right type
"ARG001", # unused function arguments are often legitimate
"ARG002", # unused method arguments are often legitimate
"ARG005", # unused lambda arguments are often legitimate
"BLE001", # we want to catch and report Exception in background tasks
"C414", # nested sorted is how you sort by multiple keys with reverse
"COM812", # omitting trailing commas allows black autoreformatting
"D102", # sometimes we use docstring inheritence
"D104", # don't see the point of documenting every package
"D105", # our style doesn't require docstrings for magic methods
"D106", # Pydantic uses a nested Config class that doesn't warrant docs
"D205", # our documentation style allows a folded first line
"EM101", # justification (duplicate string in traceback) is silly
"EM102", # justification (duplicate string in traceback) is silly
"FBT001", # positional booleans are normal for Pydantic field defaults
"FBT002", # positional booleans are normal for Pydantic field defaults
"FBT003", # positional booleans are normal for Pydantic field defaults
"FIX002", # point of a TODO comment is that we're not ready to fix it
"G004", # forbidding logging f-strings is appealing, but not our style
"RET505", # disagree that omitting else always makes code more readable
"PLR0911", # often many returns is clearer and simpler style
"PLR0913", # factory pattern uses constructors with many arguments
"PLR2004", # too aggressive about magic values
"PLW0603", # yes global is discouraged but if needed, it's needed
"S105", # good idea but too many false positives on non-passwords
"S106", # good idea but too many false positives on non-passwords
"S107", # good idea but too many false positives on non-passwords
"S603", # not going to manually mark every subprocess call as reviewed
"S607", # using PATH is not a security vulnerability
"SIM102", # sometimes the formatting of nested if statements is clearer
"SIM117", # sometimes nested with contexts are clearer
"TCH001", # we decided to not maintain separate TYPE_CHECKING blocks
"TCH002", # we decided to not maintain separate TYPE_CHECKING blocks
"TCH003", # we decided to not maintain separate TYPE_CHECKING blocks
"TD003", # we don't require issues be created for TODOs
"TID252", # if we're going to use relative imports, use them always
"TRY003", # good general advice but lint is way too aggressive
"TRY301", # sometimes raising exceptions inside try is the best flow
# The following settings should be disabled when using ruff format
# per https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]
select = ["ALL"]
target-version = "py310" # Leave at the lowest supported version.
[tool.ruff.per-file-ignores]
"tests/**" = [
"C901", # tests are allowed to be complex, sometimes that's convenient
"D101", # tests don't need docstrings
"D103", # tests don't need docstrings
"PLR0915", # tests are allowed to be long, sometimes that's convenient
"PT012", # way too aggressive about limiting pytest.raises blocks
"S101", # tests should use assert
"S106", # tests are allowed to hard-code dummy passwords
"SLF001", # tests are allowed to access private members
]
[tool.ruff.isort]
known-first-party = ["giftless", "tests"]
split-on-trailing-comma = false
[tool.ruff.flake8-bugbear]
extend-immutable-calls = [
"fastapi.Form",
"fastapi.Header",
"fastapi.Depends",
"fastapi.Path",
"fastapi.Query",
]
# These are too useful as attributes or methods to allow the conflict with the
# built-in to rule out their use.
[tool.ruff.flake8-builtins]
builtins-ignorelist = [
"all",
"any",
"dict",
"help",
"id",
"list",
"open",
"type",
]
[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.mccabe]
max-complexity = 11
[tool.ruff.pydocstyle]
convention = "numpy"
[tool.scriv]
categories = [
"Backwards-incompatible changes",
"New features",
"Bug fixes",
"Other changes",
]
entry_title_template = "{{ version }} ({{ date.strftime('%Y-%m-%d') }})"
format = "md"
md_header_level = "2"
new_fragment_template = "file:changelog.d/_template.md.jinja"
skip_fragments = "_template.md.jinja"