forked from Future-House/paper-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
415 lines (386 loc) · 14.4 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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64", "setuptools_scm>=8"]
[project]
authors = [
{email = "hello@futurehouse.org", name = "FutureHouse technical staff"},
]
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python",
]
dependencies = [
"PyMuPDF>=1.24.3", # python -c "import pymupdf" won't run before version 1.24.3
"aiohttp", # TODO: remove in favor of httpx
"anyio",
"fhaviary[llm]>=0.6", # For info on Message
"html2text", # TODO: evaluate moving to an opt-in dependency
"httpx",
"litellm>=1.44", # to prevent sys.stdout on router creation
"numpy",
"pybtex",
"pydantic-settings",
"pydantic~=2.0",
"rich",
"setuptools", # TODO: remove after release of https://bitbucket.org/pybtex-devs/pybtex/pull-requests/46/replace-pkg_resources-with-importlib
"tantivy",
"tenacity",
"tiktoken>=0.4.0",
]
description = "LLM Chain for answering questions from docs"
dynamic = ["version"]
keywords = ["question answering"]
license = {file = "LICENSE"}
maintainers = [
{email = "jamesbraza@gmail.com", name = "James Braza"},
{email = "michael.skarlinski@gmail.com", name = "Michael Skarlinski"},
{email = "white.d.andrew@gmail.com", name = "Andrew White"},
]
name = "paper-qa"
readme = "README.md"
requires-python = ">=3.11"
[project.optional-dependencies]
datasets = [
"datasets",
]
ldp = [
"ldp>=0.6", # For LiteLLM 1.42.1 pinning's UnsupportedParamsError fix
]
typing = [
"pandas-stubs",
"types-PyYAML",
"types-setuptools",
]
zotero = [
"pyzotero",
]
[project.scripts]
pqa = "paperqa.agents:main"
[project.urls]
issues = "https://github.com/Future-House/paper-qa/issues"
repository = "https://github.com/Future-House/paper-qa"
[tool.black]
preview = true
[tool.codespell]
check-filenames = true
check-hidden = true
ignore-words-list = "aadd,astroid,ser"
[tool.mypy]
# Type-checks the interior of functions without type annotations.
check_untyped_defs = true
# Allows enabling one or multiple error codes globally. Note: This option will
# override disabled error codes from the disable_error_code option.
enable_error_code = [
"ignore-without-code",
"mutable-override",
"redundant-cast",
"redundant-expr",
"redundant-self",
"truthy-bool",
"truthy-iterable",
"unimported-reveal",
"unreachable",
"unused-awaitable",
"unused-ignore",
]
# Shows a short summary line after error messages.
error_summary = false
# A regular expression that matches file names, directory names and paths which mypy
# should ignore while recursively discovering files to check. Use forward slashes (/) as
# directory separators on all platforms.
exclude = [
"^\\.?venv", # SEE: https://regex101.com/r/0rp5Br/1
]
# Specifies the OS platform for the target program, for example darwin or win32
# (meaning OS X or Windows, respectively). The default is the current platform
# as revealed by Python’s sys.platform variable.
platform = "linux"
# Comma-separated list of mypy plugins.
plugins = ["pydantic.mypy"]
# Use visually nicer output in error messages: use soft word wrap, show source
# code snippets, and show error location markers.
pretty = true
# Shows column numbers in error messages.
show_column_numbers = true
# Shows error codes in error messages.
# SEE: https://mypy.readthedocs.io/en/stable/error_codes.html#error-codes
show_error_codes = true
# Prefixes each error with the relevant context.
show_error_context = true
# Warns about casting an expression to its inferred type.
warn_redundant_casts = true
# Shows a warning when encountering any code inferred to be unreachable or
# redundant after performing type analysis.
warn_unreachable = true
# Warns about per-module sections in the config file that do not match any
# files processed when invoking mypy.
warn_unused_configs = true
# Warns about unneeded `# type: ignore` comments.
warn_unused_ignores = true
[[tool.mypy.overrides]]
# Suppresses error messages about imports that cannot be resolved.
ignore_missing_imports = true
# Per-module configuration options
module = [
"datasets", # SEE: https://github.com/huggingface/datasets/issues/3841
"litellm", # SEE: https://github.com/BerriAI/litellm/issues/825
"pybtex.*", # SEE: https://bitbucket.org/pybtex-devs/pybtex/issues/141/type-annotations
"pymupdf", # SEE: https://github.com/pymupdf/PyMuPDF/issues/3361
"pyzotero", # SEE: https://github.com/urschrei/pyzotero/issues/110
]
[tool.pylint]
[tool.pylint.design]
# Maximum number of attributes for a class (see R0902).
max-attributes = 12
[tool.pylint.format]
# Maximum number of characters on a single line.
max-line-length = 88 # Match ruff line-length
[tool.pylint.main]
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs = 0
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins = [
"pylint_pydantic",
]
[tool.pylint.messages_control]
# Disable the message, report, category or checker with the given id(s).
disable = [
"arguments-differ", # Ops intentionally differ arguments
"attribute-defined-outside-init", # Disagrees with reset pattern
"bare-except", # Rely on ruff E722 for this
"broad-exception-caught", # Don't care to enforce this
"broad-exception-raised", # Rely on ruff TRY002 for this
"cyclic-import", # Let Python blow up
"expression-not-assigned", # Rely on mypy func-returns-value for this
"fixme", # codetags are useful
"function-redefined", # Rely on mypy no-redef for this
"import-outside-toplevel", # Rely on ruff PLC0415 for this
"inconsistent-return-statements", # TODO: remove after pylint>=3.3 for https://github.com/pylint-dev/pylint/pull/9591
"invalid-name", # Don't care to enforce this
"line-too-long", # Rely on ruff E501 for this
"logging-fstring-interpolation", # f-strings are convenient
"logging-too-many-args", # Rely on ruff PLE1205 for this
"missing-docstring", # Let docformatter and ruff take care of docstrings
"missing-final-newline", # Rely on ruff W292 for this
"no-else-return", # Rely on ruff RET506 for this
"no-member", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/8138
"not-callable", # Don't care to enforce this
"protected-access", # Don't care to enforce this
"raise-missing-from", # Rely on ruff B904 for this
"redefined-builtin", # Rely on ruff A002 for this
"super-init-not-called", # Don't care to enforce this
"too-few-public-methods", # Don't care to enforce this
"too-many-ancestors", # Don't care to enforce this
"too-many-arguments", # Don't care to enforce this
"too-many-branches", # Rely on ruff PLR0912 for this
"too-many-instance-attributes", # Don't care to enforce this
"too-many-lines", # Don't care to enforce this
"too-many-locals", # Rely on ruff PLR0914 for this
"too-many-return-statements", # Rely on ruff PLR0911 for this
"too-many-statements", # Rely on ruff PLR0915 for this
"undefined-loop-variable", # Don't care to enforce this
"ungrouped-imports", # Rely on ruff I001 for this
"unidiomatic-typecheck", # Rely on ruff E721 for this
"unreachable", # Rely on mypy unreachable for this
"unspecified-encoding", # Don't care to enforce this
"unsubscriptable-object", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/3637
"unsupported-membership-test", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/3045
"unused-argument", # Rely on ruff ARG002 for this
"unused-import", # Rely on ruff F401 for this
"unused-variable", # Rely on ruff F841 for this
"wrong-import-order", # Rely on ruff I001 for this
"wrong-import-position", # Rely on ruff E402 for this
]
# Enable the message, report, category or checker with the given id(s).
enable = [
"useless-suppression", # Print unused `pylint: disable` comments
]
[tool.pylint.reports]
# Set true to activate the evaluation score.
score = false
[tool.pylint.similarities]
# Minimum lines number of a similarity.
min-similarity-lines = 12
[tool.pytest.ini_options]
# Sets a list of filters and actions that should be taken for matched warnings.
# By default all warnings emitted during the test session will be displayed in
# a summary at the end of the test session.
filterwarnings = [
"ignore:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning", # SEE: https://github.com/BerriAI/litellm/issues/2929#issuecomment-2345224633
"ignore:Support for class-based `config` is deprecated, use ConfigDict instead", # SEE: https://github.com/BerriAI/litellm/issues/5648
'ignore:open_text is deprecated. Use files\(\) instead:DeprecationWarning', # SEE: https://github.com/BerriAI/litellm/issues/5647
'ignore:pkg_resources is deprecated as an API.:DeprecationWarning:pybtex', # SEE: https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
]
# List of directories that should be searched for tests when no specific directories,
# files or test ids are given in the command line when executing pytest from the rootdir
# directory. File system paths may use shell-style wildcards, including the recursive **
# pattern.
testpaths = ["tests"]
[tool.refurb]
enable_all = true
ignore = [
"FURB101", # FURB101, FURB103, FURB141, FURB144, FURB146, FURB147, FURB150, FURB155: no need for pathlib
"FURB103",
"FURB141",
"FURB144",
"FURB146",
"FURB147",
"FURB150",
"FURB155",
]
[tool.ruff]
# Line length to use when enforcing long-lines violations (like `E501`).
line-length = 120
# Enable application of unsafe fixes.
unsafe-fixes = true
[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
# Enable preview style formatting.
preview = true
[tool.ruff.lint]
explicit-preview-rules = true
extend-select = [
"C420",
"FURB110",
"FURB113",
"FURB116",
"FURB118",
"FURB131",
"FURB132",
"FURB140",
"FURB142",
"FURB145",
"FURB148",
"FURB152",
"FURB154",
"FURB157",
"FURB164",
"FURB166",
"FURB171",
"FURB180",
"FURB192",
"PLR6104",
"PLR6201",
"PLW0108",
"RUF022",
]
# List of rule codes that are unsupported by Ruff, but should be preserved when
# (e.g.) validating # noqa directives. Useful for retaining # noqa directives
# that cover plugins not yet implemented by Ruff.
external = [
"FURB", # refurb
]
ignore = [
"ANN", # Don't care to enforce typing
"BLE001", # Don't care to enforce blind exception catching
"C901", # we can be complex
"COM812", # Trailing comma with black leads to wasting lines
"D100", # D100, D101, D102, D103, D104, D105, D106, D107: don't always need docstrings
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D203", # Keep docstring next to the class definition (covered by D211)
"D212", # Summary should be on second line (opposite of D213)
"D402", # It's nice to reuse the method name
"D406", # Google style requires ":" at end
"D407", # We aren't using numpy style
"D413", # Blank line after last section. -> No blank line
"DTZ", # Don't care to have timezone safety
"EM", # Overly pedantic
"ERA001", # Don't care to prevent commented code
"FBT001", # FBT001, FBT002: overly pedantic
"FBT002",
"FIX", # Don't care to prevent TODO, FIXME, etc.
"FLY002", # Can be less readable
"G004", # f-strings are convenient
"INP001", # Can use namespace packages
"ISC001", # For ruff format compatibility
"N803", # Want to use 'N', or 'L',
"N806", # Want to use 'N', or 'L',
"PLR0913",
"PLR0915", # we can write lots of code
"PLW2901", # Allow modifying loop variables
"PTH", # Overly pedantic
"S311", # Ok to use python random
"SLF001", # Overly pedantic
"T201", # Overly pedantic
"TCH001", # TCH001, TCH002, TCH003: don't care to enforce type checking blocks
"TCH002",
"TCH003",
"TD002", # Don't care for TODO author
"TD003", # Don't care for TODO links
"TRY003", # Overly pedantic
]
preview = true
select = ["ALL"]
unfixable = [
"B007", # While debugging, unused loop variables can be useful
"B905", # Default fix is zip(strict=False), but that can hide bugs
"ERA001", # While debugging, temporarily commenting code can be useful
"F401", # While debugging, unused imports can be useful
"F841", # While debugging, unused locals can be useful
"TCH004", # While debugging, it can be nice to keep TYPE_CHECKING in tact
]
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
[tool.ruff.lint.per-file-ignores]
"**/tests/*.py" = [
"N802", # Tests function names can match class names
"PLR2004", # Tests can have magic values
"S101", # Tests can have assertions
"S301", # can test pickle
"S310",
]
[tool.ruff.lint.pycodestyle]
# The maximum line length to allow for line-length violations within
# documentation (W505), including standalone comments.
max-doc-length = 120 # Match line-length
[tool.ruff.lint.pydocstyle]
# Whether to use Google-style or NumPy-style conventions or the PEP257
# defaults when analyzing docstring sections.
convention = "google"
[tool.setuptools.package-data]
paperqa = ["configs/**json"]
[tool.setuptools.packages.find]
include = ["paperqa*"]
[tool.setuptools_scm]
version_file = "paperqa/version.py"
[tool.tomlsort]
all = true
in_place = true
spaces_before_inline_comment = 2 # Match Python PEP 8
spaces_indent_inline_array = 4 # Match Python PEP 8
trailing_comma_inline_array = true
[tool.uv]
dev-dependencies = [
"ipython>=8", # Pin to keep recent
"mypy>=1.8", # Pin for mutable-override
"paper-qa[datasets,ldp,typing,zotero]",
"pre-commit~=3.4", # Pin to keep recent
"pydantic~=2.0",
"pylint-pydantic",
"pytest-asyncio",
"pytest-recording",
"pytest-rerunfailures",
"pytest-subtests",
"pytest-sugar",
"pytest-timer[colorama]",
"pytest-xdist",
"pytest>=8", # Pin to keep recent
"python-dotenv",
"refurb>=2", # Pin to keep recent
]