Skip to content

Commit f65adb0

Browse files
authored
Updating tooling for jupytext + black break (#1191)
1 parent 1b57725 commit f65adb0

File tree

10 files changed

+48
-24
lines changed

10 files changed

+48
-24
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ repos:
2525
- id: mixed-line-ending
2626
- id: trailing-whitespace
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.13.2
28+
rev: v0.14.4
2929
hooks:
3030
- id: ruff-check
3131
args: [--fix, --exit-non-zero-on-fix]
3232
- repo: https://github.com/psf/black-pre-commit-mirror
33-
rev: 25.9.0
33+
rev: 25.11.0
3434
hooks:
35-
- id: black
35+
- id: black-jupyter
3636
- repo: https://github.com/rbubley/mirrors-prettier
3737
rev: v3.6.2
3838
hooks:
@@ -48,19 +48,19 @@ repos:
4848
- id: codespell
4949
additional_dependencies: [".[toml]"]
5050
- repo: https://github.com/crate-ci/typos
51-
rev: v1.36.3
51+
rev: v1.39.0
5252
hooks:
5353
- id: typos
5454
- repo: https://github.com/jumanjihouse/pre-commit-hooks
5555
rev: 3.0.0
5656
hooks:
5757
- id: check-mailmap
5858
- repo: https://github.com/henryiii/validate-pyproject-schema-store
59-
rev: 2025.09.26
59+
rev: 2025.11.04
6060
hooks:
6161
- id: validate-pyproject
6262
- repo: https://github.com/astral-sh/uv-pre-commit
63-
rev: 0.8.22
63+
rev: 0.9.8
6464
hooks:
6565
- id: uv-lock
6666
- repo: https://github.com/adamchainz/blacken-docs
@@ -74,19 +74,19 @@ repos:
7474
- id: nb-clean
7575
args: [--preserve-cell-outputs, --remove-empty-cells]
7676
- repo: https://github.com/jackdewinter/pymarkdown
77-
rev: v0.9.32
77+
rev: v0.9.33
7878
hooks:
7979
- id: pymarkdown
8080
exclude: docs/tutorials/
8181
- repo: https://github.com/mwouts/jupytext
82-
rev: v1.17.3
82+
rev: v1.18.1
8383
hooks:
8484
- id: jupytext
8585
args: [--to, md, --pipe, black]
86-
additional_dependencies: [black]
86+
additional_dependencies: [black<25.11.0] # Downpin for https://github.com/mwouts/jupytext/issues/1467
8787
files: ^docs/.*\.ipynb$
8888
- repo: https://github.com/jsh9/markdown-toc-creator
89-
rev: 0.0.10
89+
rev: 0.1.3
9090
hooks:
9191
- id: markdown-toc-creator
9292
- repo: local # Use local so we can inspect paperqa.version

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ question answering, summarization, and contradiction detection.
1616

1717
<!--TOC-->
1818

19+
---
20+
21+
**Table of Contents**
22+
1923
- [Quickstart](#quickstart)
2024
- [Example Output](#example-output)
2125
- [What is PaperQA2](#what-is-paperqa2)
@@ -56,6 +60,8 @@ question answering, summarization, and contradiction detection.
5660
- [Reproduction](#reproduction)
5761
- [Citation](#citation)
5862

63+
---
64+
5965
<!--TOC-->
6066

6167
## Quickstart

docs/tutorials/running_on_lfrqa.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@
361361
"os.makedirs(log_results_dir, exist_ok=True)\n",
362362
"\n",
363363
"\n",
364-
"async def log_evaluation_to_json(lfrqa_question_evaluation: dict) -> None: # noqa: RUF029\n",
364+
"async def log_evaluation_to_json( # noqa: RUF029\n",
365+
" lfrqa_question_evaluation: dict,\n",
366+
") -> None:\n",
365367
" json_path = os.path.join(\n",
366368
" log_results_dir, f\"{lfrqa_question_evaluation['qid']}.json\"\n",
367369
" )\n",
@@ -409,7 +411,7 @@
409411
"\n",
410412
"\n",
411413
"if __name__ == \"__main__\":\n",
412-
" asyncio.run(evaluate())\n"
414+
" asyncio.run(evaluate())"
413415
]
414416
},
415417
{
@@ -437,7 +439,7 @@
437439
" data.append(json_data)\n",
438440
"\n",
439441
"results_df = pd.DataFrame(data).set_index(\"qid\")\n",
440-
"results_df[\"winner\"].value_counts(normalize=True)\n"
442+
"results_df[\"winner\"].value_counts(normalize=True)"
441443
]
442444
}
443445
],

docs/tutorials/running_on_lfrqa.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
extension: .md
66
format_name: markdown
77
format_version: '1.3'
8-
jupytext_version: 1.17.3
8+
jupytext_version: 1.18.1
99
kernelspec:
1010
display_name: .venv
1111
language: python
@@ -253,9 +253,9 @@ log_results_dir = os.path.join("data", "rag-qa-benchmarking", "results")
253253
os.makedirs(log_results_dir, exist_ok=True)
254254

255255

256-
async def log_evaluation_to_json(
256+
async def log_evaluation_to_json( # noqa: RUF029
257257
lfrqa_question_evaluation: dict,
258-
) -> None: # noqa: RUF029
258+
) -> None:
259259
json_path = os.path.join(
260260
log_results_dir, f"{lfrqa_question_evaluation['qid']}.json"
261261
)
@@ -306,7 +306,6 @@ if __name__ == "__main__":
306306
asyncio.run(evaluate())
307307
```
308308

309-
310309
After running this, you can find the results in the `data/rag-qa-benchmarking/results` folder. Here is an example of how to read them:
311310

312311
```python

docs/tutorials/settings_tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.17.3
9+
jupytext_version: 1.18.1
1010
kernelspec:
1111
display_name: test
1212
language: python

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ skip = [
135135
"tests/stub_data/*",
136136
]
137137

138+
[tool.markdown_toc_creator]
139+
horizontal-rule-style = "prettier"
140+
proactive = false
141+
138142
[tool.mypy]
139143
# Type-checks the interior of functions without type annotations.
140144
check_untyped_defs = true
@@ -220,7 +224,7 @@ max-line-length = 88 # Match ruff line-length
220224
# Files or directories matching the regular expression patterns are skipped.
221225
# The regex matches against base names, not paths. The default value ignores
222226
ignore-patterns = [
223-
"version.py", # setuptools-scm version files, SEE: https://github.com/pylint-dev/pylint/issues/10479
227+
"^version\\.py$", # Version files made by setuptools_scm, SEE: https://github.com/pylint-dev/pylint/issues/10479
224228
]
225229
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
226230
# number of processors available to use, and will cap the count on Windows to
@@ -250,6 +254,7 @@ disable = [
250254
"global-statement", # Rely on ruff PLW0603 for this
251255
"global-variable-not-assigned", # Rely on ruff PLW0602 for this
252256
"import-outside-toplevel", # Rely on ruff PLC0415 for this
257+
"import-private-name", # Rely on ruff PLC2701 for this
253258
"invalid-name", # Don't care to enforce this
254259
"keyword-arg-before-vararg", # Rely on ruff B026 for this
255260
"line-too-long", # Rely on ruff E501 for this
@@ -289,7 +294,9 @@ disable = [
289294
"unused-argument", # Rely on ruff ARG002 for this
290295
"unused-import", # Rely on ruff F401 for this
291296
"unused-variable", # Rely on ruff F841 for this
297+
"unused-wildcard-import", # Wildcard imports are convenient
292298
"use-sequence-for-iteration", # Rely on ruff C0208 for this
299+
"wildcard-import", # Wildcard imports are convenient
293300
"wrong-import-order", # Rely on ruff I001 for this
294301
"wrong-import-position", # Rely on ruff E402 for this
295302
]
@@ -367,11 +374,14 @@ preview = true
367374
explicit-preview-rules = true
368375
extend-select = [
369376
"ASYNC212",
377+
"ASYNC240",
370378
"ASYNC250",
371379
"B901",
372380
"B903",
373381
"B909",
382+
"B912",
374383
"CPY001",
384+
"DOC102",
375385
"DOC201",
376386
"DOC202",
377387
"DOC402",
@@ -477,6 +487,7 @@ extend-select = [
477487
"RUF061",
478488
"RUF063",
479489
"RUF064",
490+
"RUF065",
480491
"RUF102",
481492
"TC008",
482493
"UP042",
@@ -568,6 +579,7 @@ mypy-init-return = true
568579
[tool.ruff.lint.per-file-ignores]
569580
"**/tests/*.py" = [
570581
"N802", # Tests function names can match class names
582+
"PLC2701", # Test can import private names if needed
571583
"PLR2004", # Tests can have magic values
572584
"PLR6301", # Test classes can ignore self
573585
"S101", # Tests can have assertions

src/paperqa/agents/search.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ async def process_file(
499499
) -> None:
500500

501501
abs_file_path = (
502-
pathlib.Path(settings.agent.index.paper_directory).absolute() / rel_file_path
502+
pathlib.Path(settings.agent.index.paper_directory).absolute() # noqa: ASYNC240
503+
/ rel_file_path
503504
)
504505
fallback_title = rel_file_path.name
505506
if settings.agent.index.use_absolute_paper_directory:

src/paperqa/clients/crossref.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ async def download_retracted_dataset(
377377
async for chunk in response.aiter_bytes(chunk_size=1024):
378378
await f.write(chunk)
379379

380-
if os.path.getsize(str(retraction_data_path)) == 0:
380+
if os.path.getsize(str(retraction_data_path)) == 0: # noqa: ASYNC240
381381
raise RuntimeError("Retraction data is empty")
382382

383383

src/paperqa/contrib/openreview_paper_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ async def _get_relevant_papers_chunk(self, question: str, chunk: str) -> list[An
122122

123123
async def download_papers(self, submissions: list[Any]) -> None:
124124
"""Download PDFs for given submissions."""
125-
downloaded_papers = Path(self.settings.paper_directory).rglob("*.pdf")
125+
downloaded_papers = Path(self.settings.paper_directory).rglob( # noqa: ASYNC240
126+
"*.pdf"
127+
)
126128
downloaded_ids = [p.stem for p in downloaded_papers]
127129
logger.info("Downloading PDFs for relevant papers.")
128130
for submission in submissions:
@@ -151,7 +153,9 @@ async def aadd_docs(
151153
) -> Docs:
152154
if docs is None:
153155
docs = Docs()
154-
for doc_path in Path(self.settings.paper_directory).rglob("*.pdf"):
156+
for doc_path in Path(self.settings.paper_directory).rglob( # noqa: ASYNC240
157+
"*.pdf"
158+
):
155159
sub = subs.get(doc_path.stem) if subs is not None else None
156160
if sub:
157161
await docs.aadd(

tests/test_paperqa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
from paperqa.clients.journal_quality import JournalQualityPostProcessor
6262
from paperqa.core import (
6363
LLMContextTimeoutError,
64-
_map_fxn_summary, # noqa: PLC2701
64+
_map_fxn_summary,
6565
llm_parse_json,
6666
map_fxn_summary,
6767
)

0 commit comments

Comments
 (0)