-
Notifications
You must be signed in to change notification settings - Fork 7
/
pyproject.toml
343 lines (327 loc) · 10.8 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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
'^\s*\.\.\.\s*$',
'^\s*pass\s*$',
'^\s*raise NotImplementedError\s*$',
]
include_namespace_packages = true
[tool.coverage.run]
branch = true
concurrency = ["multiprocessing", "thread"]
parallel = true
relative_files = true
source = ["src"]
[tool.isort]
known_first_party = ["palace"]
known_third_party = ["alembic"]
profile = "black"
[tool.mypy]
# TODO: Enable the the check_untyped_defs option
# This will get rid of the warnings that we get when running mypy
# > note: By default the bodies of untyped functions are not checked
# However this currently causes a number of errors to surface that will
# need to be cleaned up before we can enable the option.
# check_untyped_defs = true
# When we enable this option, we should remove this disable. Its just here
# to silence the noise in the mypy output for now, so its easier to see when
# there are errors in the output.
disable_error_code = "annotation-unchecked"
explicit_package_bases = true
files = ["alembic", "src/palace", "tests"]
mypy_path = ["alembic", "src"]
plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"]
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
# In our tests, we often overwrite methods on classes to mock out behavior.
# This is a common pattern in Python, but mypy doesn't like it. This override
# silences those errors, but only for the tests module.
# See discussion here:
# https://github.com/python/mypy/issues/2427
disable_error_code = "method-assign, union-attr"
module = "tests.*"
# Mypy seems to have issues in the test code where it thinks code is unreachable
# when it is not. So we disable this warning for the tests module.
warn_unreachable = false
[[tool.mypy.overrides]]
# This override is the equivalent of running mypy with the --strict flag.
# This is a work in progress, but we should try to get as many of our files
# into the module list here as possible.
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
module = [
"palace.manager.api.admin.announcement_list_validator",
"palace.manager.api.admin.config",
"palace.manager.api.admin.controller.catalog_services",
"palace.manager.api.admin.controller.collection_settings",
"palace.manager.api.admin.controller.discovery_service_library_registrations",
"palace.manager.api.admin.controller.discovery_services",
"palace.manager.api.admin.controller.integration_settings",
"palace.manager.api.admin.controller.library_settings",
"palace.manager.api.admin.controller.metadata_services",
"palace.manager.api.admin.controller.patron",
"palace.manager.api.admin.controller.patron_auth_services",
"palace.manager.api.admin.controller.report",
"palace.manager.api.admin.controller.util",
"palace.manager.api.admin.dashboard_stats",
"palace.manager.api.admin.form_data",
"palace.manager.api.admin.model.dashboard_statistics",
"palace.manager.api.adobe_vendor_id",
"palace.manager.api.axis",
"palace.manager.api.circulation",
"palace.manager.api.circulation_exceptions",
"palace.manager.api.controller.circulation_manager",
"palace.manager.api.controller.loan",
"palace.manager.api.controller.marc",
"palace.manager.api.controller.odl_notification",
"palace.manager.api.controller.patron_activity_history",
"palace.manager.api.discovery.*",
"palace.manager.api.enki",
"palace.manager.api.lcp.hash",
"palace.manager.api.metadata.*",
"palace.manager.api.odl.*",
"palace.manager.api.opds_for_distributors",
"palace.manager.core.opds2_import",
"palace.manager.core.opds_import",
"palace.manager.core.selftest",
"palace.manager.feed.*",
"palace.manager.integration.*",
"palace.manager.marc.*",
"palace.manager.opds.*",
"palace.manager.scripts.initialization",
"palace.manager.scripts.rotate_jwe_key",
"palace.manager.scripts.search",
"palace.manager.search.document",
"palace.manager.search.migrator",
"palace.manager.search.revision",
"palace.manager.search.revision_directory",
"palace.manager.search.service",
"palace.manager.search.v5",
"palace.manager.service.*",
"palace.manager.sqlalchemy.hassessioncache",
"palace.manager.sqlalchemy.model.announcements",
"palace.manager.sqlalchemy.model.collection",
"palace.manager.sqlalchemy.model.integration",
"palace.manager.sqlalchemy.model.library",
"palace.manager.sqlalchemy.model.patron",
"palace.manager.sqlalchemy.util",
"palace.manager.util.authentication_for_opds",
"palace.manager.util.base64",
"palace.manager.util.cache",
"palace.manager.util.http",
"palace.manager.util.log",
"palace.manager.util.migration.*",
"palace.manager.util.notifications",
"palace.manager.util.problem_detail",
"palace.manager.util.string_helpers",
"palace.manager.util.uuid",
"palace.manager.util.worker_pools",
"palace.manager.util.xmlparser",
"tests.fixtures.authenticator",
"tests.fixtures.webserver",
"tests.migration.*",
]
no_implicit_reexport = true
strict_concatenate = true
strict_equality = true
warn_return_any = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
# Custom mypy overrides for the palace.manager.celery module.
# Since Celery is untyped, and we're using a lot of its
# features, we disable some of the strict mypy checks
# that get annoying when working with Celery.
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = false
disallow_untyped_decorators = false
disallow_untyped_defs = true
module = [
"palace.manager.celery.*",
]
no_implicit_reexport = true
strict_concatenate = true
strict_equality = true
warn_return_any = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
# This override silences errors for modules we import that don't currently
# have type hints, or type stubs that cover them. We should go through this
# list periodically and remove modules that have since added type hints.
ignore_missing_imports = true
module = [
"aws_xray_sdk.ext.*",
"celery.*",
"expiringdict",
"feedparser",
"firebase_admin.*",
"flask_babel",
"fuzzywuzzy",
"google.auth",
"greenlet",
"html_sanitizer",
"isbnlib",
"jsonschema.*",
"jwcrypto",
"kombu.*",
"lxml.*",
"multipledispatch",
"nameparser",
"onelogin.saml2.*",
"opensearch_dsl.*",
# This is ignored because the file is created when building a container
# so it typically doesn't exist when running mypy, but since it only
# contains a couple version strings it can be safely ignored
"palace.manager._version",
"pyld",
"textblob.*",
"unicodecsv",
"uwsgi",
"wcag_contrast_ratio",
"webpub_manifest_parser.*",
]
[tool.poetry]
authors = ["The Palace Project <info@thepalaceproject.org>"]
description = "The Palace Project Manager Application"
homepage = "https://thepalaceproject.org"
license = "Apache-2.0"
name = "palace.manager"
packages = [{include = "palace/manager", from = "src"}]
readme = "README.md"
repository = "https://github.com/ThePalaceProject/circulation"
version = "0" # Version number is managed with tags in git
[tool.poetry.dependencies]
alembic = {extras = ["tz"], version = "^1.8.1"}
aws-xray-sdk = "~2.14"
# Lets us use StrEnum for Python 3.10 and below
# TODO: Remove this when we drop support for Python 3.10
"backports.strenum" = {version = "^1.3.1", python = "<3.11"}
bcrypt = "^4.0.1"
boto3 = "^1.28"
celery = {extras = ["redis", "tblib", 'sqs'], version = "^5.3.6"}
certifi = "*"
click = "^8.1.3"
contextlib2 = "21.6.0"
dependency-injector = "^4.41"
expiringdict = "1.2.2"
feedparser = "6.0.11"
firebase-admin = "^6.0.1"
Flask = "^3.0"
Flask-Babel = "^4.0"
Flask-Cors = "5.0.0"
fuzzywuzzy = "0.18.0" # fuzzywuzzy is for author name manipulations
html-sanitizer = "^2.1.0"
isbnlib = "^3.10.14"
itsdangerous = "^2.1.2"
jsonschema = "^4.22.0"
jwcrypto = "^1.4.2"
levenshtein = "^0.26"
lxml = {extras = ["html-clean"], version = "^5.2.1"}
multipledispatch = "^1.0"
nameparser = "^1.1" # nameparser is for author name manipulations
opensearch-dsl = "~1.0"
opensearch-py = "~1.1"
palace-webpub-manifest-parser = "^4.0.0"
pillow = "^11.0"
pycryptodome = "^3.18"
pydantic = {version = "^2.9.2", extras = ["email"]}
pydantic-settings = "^2.5.2"
pyinstrument = "^5.0"
PyJWT = "^2.8"
PyLD = "2.0.4"
pymarc = "5.2.3"
pyOpenSSL = "^24.0.0"
pyparsing = "3.2.0"
pyspellchecker = "0.8.1"
python = ">=3.10,<4"
python-dateutil = "2.9.0.post0"
python3-saml = "^1.16" # python-saml is required for SAML authentication
pytz = "^2024.1"
pyyaml = "^6.0"
redis = "^5.0.5"
redmail = "^0.6.0"
requests = "^2.29"
sqlalchemy = {version = "^1.4", extras = ["mypy"]}
tenacity = "^9.0.0"
textblob = "0.18.0.post0"
types-pyopenssl = "^24.0.0.20240130"
types-pyyaml = "^6.0.12.9"
# We import typing_extensions, so we can use new annotation features.
# - Self (Python 3.11)
typing_extensions = {version = "^4.5.0", python = "<3.11"}
unicodecsv = "0.14.1" # this is used, but can probably be removed on py3
uritemplate = "4.1.1"
urllib3 = "^1.26.17"
uWSGI = "~2.0.21"
watchtower = "3.3.1" # watchtower is for Cloudwatch logging integration
wcag-contrast-ratio = "0.9"
Werkzeug = "^3.0.0"
[tool.poetry.group.ci.dependencies]
dunamai = "^1.16"
pre-commit = "^4.0"
tox = "^4.4"
tox-docker = "^5.0"
tox-gh-actions = "^3.0"
[tool.poetry.group.dev.dependencies]
boto3-stubs = {version = "^1.28", extras = ["boto3", "cloudwatch", "essential", "logs", "s3"]}
freezegun = "~1.5.0"
Jinja2 = "^3.1.2"
mypy = "^1.4.1"
psycopg2-binary = "~2.9.5"
pyfakefs = "^5.3"
pytest = ">=7.2.0"
pytest-alembic = "^0.11.0"
pytest-celery = "^0.0.0"
pytest-cov = "^6.0.0"
pytest-timeout = "*"
pytest-xdist = "^3.5.0"
requests-mock = "1.12.1"
types-aws-xray-sdk = "^2.11.0.13"
types-Flask-Cors = "^5.0.0"
types-Pillow = "^10.0.0"
types-psycopg2 = "^2.9.21"
types-python-dateutil = "^2.8.19"
types-pytz = "^2024.1"
types-redis = "^4.6.0.20240425"
types-requests = "^2.28.11"
[tool.poetry.group.pg]
optional = true
[tool.poetry.group.pg.dependencies]
psycopg2 = "~2.9.5"
[tool.pytest.ini_options]
addopts = [
"--cov",
"--cov-report=xml",
"--dist=worksteal",
"--numprocesses=auto",
"--strict-markers",
]
filterwarnings = [
"error::pydantic.PydanticDeprecatedSince20",
"error::pytest.PytestWarning",
]
markers = [
"minio: mark test as requiring minio",
"opensearch: mark test as requiring opensearch",
]
timeout = "600"
timeout_method = "thread"
[tool.tomlsort]
ignore_case = true
in_place = true
sort_inline_arrays = true
sort_table_keys = true
spaces_before_inline_comment = 2
spaces_indent_inline_array = 4
trailing_comma_inline_array = true