Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
157 lines (145 loc) · 6.05 KB
/
Copy pathpyproject.toml
File metadata and controls
157 lines (145 loc) · 6.05 KB
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
[project]
name = "reprobot"
version = "0.1.0"
description = "Multi-agent pipeline for automated ML paper replication."
readme = "README.md"
requires-python = ">=3.13"
license = { file = "LICENSE" }
dependencies = [
"loguru>=0.7",
]
[project.optional-dependencies]
# OCR/extraction backends that this project's own uv lock manages — i.e. the
# ones that actually install on this dev machine (Intel macOS + Python 3.13).
# See ocr/README.md for Docling and MinerU, which are NOT declared here: both
# depend on torch, and no torch release supports Python 3.13 and Intel-macOS
# wheels at the same time (PyTorch dropped Intel-macOS wheels in the same
# release range it added 3.13 support) — including either in this lock would
# make the whole project un-syncable on this machine. Run those two in a
# separate environment; see ocr/README.md for exact commands.
pdfplumber = [
"pdfplumber>=0.11",
]
vlm = [
"anthropic>=0.69",
"pypdfium2>=4.30",
"python-dotenv>=1.0",
# vlm_extract.py renders each page with pypdfium2's `bitmap.to_pil()`, which
# needs Pillow. This was missing for a long time and nobody noticed, because
# the `pdfplumber` extra pulls Pillow in transitively and the venv usually had
# both. An exact `uv sync` without `pdfplumber` then broke OCR on every paper
# with "No module named 'PIL'" - declare it directly rather than rely on a
# sibling extra that happens to share a dependency.
"pillow>=10.0",
]
# reader/ (Claude tool-use over already-extracted Markdown) needs the
# Anthropic SDK + dotenv but not pypdfium2 — it never touches a PDF or
# renders a page image, it only reads ocr/'s Markdown output. Kept as its
# own extra rather than reusing `vlm` so each stage stays independently
# installable (`uv sync --extra reader`), per this repo's one-folder-per-
# stage, no-shared-package convention.
reader = [
"anthropic>=0.69",
"python-dotenv>=1.0",
]
# coder/ (Claude tool-use over reader/'s JSON + ocr/'s Markdown) has the same
# dependency shape as reader/ and, importantly, does NOT need torch: it only
# *writes* a training script, it never executes one. Keeping torch out is what
# lets this stage stay in the managed lock on the Intel-macOS dev machine (see
# the note above); the generated script's torch/torchvision/transformers
# dependencies belong to the future runner/ Docker image, not to this project.
coder = [
"anthropic>=0.69",
"python-dotenv>=1.0",
]
# runner/ executes coder/'s generated scripts in a Docker sandbox, and is the
# ANSWER to the platform trap above rather than another instance of it: torch
# lives only inside runner/Dockerfile's image, whose own Linux CPython is
# unaffected by the host's Intel-macOS/3.13 constraint. On the host this stage
# shells out to the `docker` CLI via subprocess, so it needs no docker Python
# SDK either - just the Anthropic SDK for the single failure-triage call.
runner = [
"anthropic>=0.69",
"python-dotenv>=1.0",
]
# orchestrator/ drives coder/ and runner/ round the retry loop. It makes no API
# call of its own - the Anthropic SDK is here because it constructs the client
# that the two stages it drives use - and it shells out to nothing itself, so it
# inherits their (torch-free) dependency shape exactly.
orchestrator = [
"anthropic>=0.69",
"python-dotenv>=1.0",
]
# viewer/ is a Streamlit dashboard over the files ocr/, reader/, and coder/
# have already written, plus buttons that call each stage's own entry point
# (run_vlm / reader.run_pipeline / coder.run_pipeline) unmodified. It therefore
# needs those stages' deps (anthropic + dotenv + pypdfium2 for the OCR import
# path) alongside streamlit and pandas. No torch, so it stays in the managed
# lock like the rest.
viewer = [
"streamlit>=1.38",
"pandas>=2.2",
"anthropic>=0.69",
"pypdfium2>=4.30",
"python-dotenv>=1.0",
]
# The Critic's verdict is pure arithmetic, but its v2 review is one Claude call,
# so it needs the same client as every other model-calling stage.
critic = [
"anthropic>=0.69",
"python-dotenv>=1.0",
]
[dependency-groups]
dev = [
"mypy>=1.13",
"pandas-stubs>=2.2",
"pre-commit>=4.0",
"pytest>=9.1.1",
"pytest-cov>=6.0",
"ruff>=0.8",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["ocr", "reader", "coder", "runner", "orchestrator", "critic", "report", "viewer"]
[tool.ruff]
line-length = 100
target-version = "py313"
# docs/ holds document-generation scripts, not pipeline code. Their long lines are
# LaTeX and TikZ held in raw strings, where a "fix" to the line length would change
# the rendered figure. Lint the pipeline stages; leave the typesetting alone.
extend-exclude = ["docs/"]
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B", "SIM", "N", "C4", "PTH"]
[tool.ruff.format]
quote-style = "double"
[tool.mypy]
python_version = "3.13"
strict = true
# coder/output/ holds GENERATED training scripts. They are standalone artifacts
# meant to run inside the future runner/ Docker image against torch/torchvision/
# transformers — none of which are (or can be) installed here, per the Intel-macOS
# platform trap above — and they are deliberately written in plain untyped Python,
# not to this project's --strict standard. They are gitignored, and their
# correctness gate is coder/pipeline.py's ast.parse plus the future Runner, not
# mypy. Without this, `mypy --strict coder/` recurses into them and fails.
exclude = ["^coder/output/"]
[[tool.mypy.overrides]]
module = "pypdfium2.*"
ignore_missing_imports = true
[tool.coverage.run]
branch = true
source = ["coder", "critic", "ocr", "orchestrator", "reader", "report", "runner"]
# viewer/ is a Streamlit app: ~1,000 statements of page layout and widget callbacks whose
# behaviour is what a person sees, not something a unit test can assert. Measuring it only
# dilutes the number for the logic that tests actually guard.
omit = ["*/__init__.py", "viewer/*"]
[tool.coverage.report]
show_missing = false
skip_covered = false
exclude_also = [
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]