fieldproof 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fieldproof-0.2.1 → fieldproof-0.2.3}/CHANGELOG.md +29 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/PKG-INFO +11 -7
- {fieldproof-0.2.1 → fieldproof-0.2.3}/README.md +1 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/pyproject.toml +14 -7
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/__init__.py +1 -1
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/cli.py +19 -1
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/extract/base.py +10 -1
- {fieldproof-0.2.1 → fieldproof-0.2.3}/.gitignore +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/LICENSE +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/document/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/document/loader.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/document/model.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/document/ocr.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/document/render.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/extract/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/extract/anthropic_provider.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/extract/fixture_provider.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/ground/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/ground/align.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/ground/normalize.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/schemas/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/schemas/base.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/schemas/contract.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/schemas/invoice.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/schemas/receipt.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/app.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/static/assets/index-BLATbujI.js +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/static/assets/index-Bo892MpF.css +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/static/index.html +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/store.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/verify/__init__.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/verify/cross_field.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/verify/engine.py +0 -0
- {fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/verify/value_checks.py +0 -0
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.3] - 2026-10-02
|
|
6
|
+
|
|
7
|
+
### Security
|
|
8
|
+
|
|
9
|
+
- The oldest dependency versions the package accepted had published
|
|
10
|
+
advisories in exactly the code that reads what a stranger uploads:
|
|
11
|
+
`python-multipart` 0.0.9, `starlette` 0.38.6 (through `fastapi` 0.115),
|
|
12
|
+
`pdfminer.six` 20231228 (through `pdfplumber` 0.11.0) and `Pillow` 10.4
|
|
13
|
+
(the `ocr` extra), plus `click` 8.1.8. An ordinary install already got
|
|
14
|
+
current versions; an install held back by another package's constraints
|
|
15
|
+
could get those. The minimums are now the first releases without an
|
|
16
|
+
advisory: `python-multipart>=0.0.31`, `starlette>=1.3.1`,
|
|
17
|
+
`pdfminer.six>=20251230`, `click>=8.3.3`, `Pillow>=12.3`, and with them
|
|
18
|
+
`fastapi>=0.133`, `pdfplumber>=0.11.9`, `typer>=0.16`. `pip-audit` reports
|
|
19
|
+
nothing for the locked versions or for the minimum ones, and the tests pass
|
|
20
|
+
on both.
|
|
21
|
+
|
|
22
|
+
## [0.2.2] - 2026-10-02
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- A result or fixture JSON saved by a Windows editor or shell. Notepad's
|
|
27
|
+
"UTF-8 with BOM" and PowerShell's `-Encoding utf8` put a byte-order mark
|
|
28
|
+
first ("not valid JSON (line 1, column 1: Unexpected UTF-8 BOM ...)"), and
|
|
29
|
+
PowerShell's `>` writes UTF-16 ("is not UTF-8 text"). All three are read, by
|
|
30
|
+
the CLI and by the review server.
|
|
31
|
+
- Output written to a pipe or a file is UTF-8, so a document path outside the
|
|
32
|
+
system's code page can be printed when stdout is redirected on Windows.
|
|
33
|
+
|
|
5
34
|
## [0.2.1] - 2026-10-02
|
|
6
35
|
|
|
7
36
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fieldproof
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Document extraction that shows its work: every field linked to the exact words it came from.
|
|
5
5
|
Project-URL: Homepage, https://antonsoo.github.io/fieldproof/
|
|
6
6
|
Project-URL: Repository, https://github.com/antonsoo/fieldproof
|
|
@@ -18,23 +18,26 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
18
18
|
Classifier: Topic :: Text Processing :: Linguistic
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
20
|
Requires-Dist: anthropic>=0.77
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
21
|
+
Requires-Dist: click>=8.3.3
|
|
22
|
+
Requires-Dist: fastapi>=0.133
|
|
23
|
+
Requires-Dist: pdfminer-six>=20251230
|
|
24
|
+
Requires-Dist: pdfplumber>=0.11.9
|
|
23
25
|
Requires-Dist: pydantic>=2.10
|
|
24
26
|
Requires-Dist: pypdfium2>=4.30
|
|
25
|
-
Requires-Dist: python-multipart>=0.0.
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.31
|
|
26
28
|
Requires-Dist: rapidfuzz>=3.9
|
|
27
|
-
Requires-Dist:
|
|
29
|
+
Requires-Dist: starlette>=1.3.1
|
|
30
|
+
Requires-Dist: typer>=0.16
|
|
28
31
|
Requires-Dist: uvicorn[standard]>=0.30
|
|
29
32
|
Provides-Extra: dev
|
|
30
33
|
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
31
34
|
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
32
35
|
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
33
|
-
Requires-Dist: pytest>=
|
|
36
|
+
Requires-Dist: pytest>=9.0.3; extra == 'dev'
|
|
34
37
|
Requires-Dist: reportlab>=4.2; extra == 'dev'
|
|
35
38
|
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
36
39
|
Provides-Extra: ocr
|
|
37
|
-
Requires-Dist: pillow>=
|
|
40
|
+
Requires-Dist: pillow>=12.3; extra == 'ocr'
|
|
38
41
|
Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
|
|
39
42
|
Description-Content-Type: text/markdown
|
|
40
43
|
|
|
@@ -42,6 +45,7 @@ Description-Content-Type: text/markdown
|
|
|
42
45
|
|
|
43
46
|
**Document extraction that shows its work: every field linked to the exact words it came from.**
|
|
44
47
|
|
|
48
|
+
[](https://pypi.org/project/fieldproof/)
|
|
45
49
|
[](https://github.com/antonsoo/fieldproof/blob/main/LICENSE)
|
|
46
50
|
[](https://antonsoo.github.io/fieldproof/)
|
|
47
51
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Document extraction that shows its work: every field linked to the exact words it came from.**
|
|
4
4
|
|
|
5
|
+
[](https://pypi.org/project/fieldproof/)
|
|
5
6
|
[](LICENSE)
|
|
6
7
|
[](https://antonsoo.github.io/fieldproof/)
|
|
7
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fieldproof"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3"
|
|
4
4
|
description = "Document extraction that shows its work: every field linked to the exact words it came from."
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -27,20 +27,27 @@ classifiers = [
|
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
29
|
"pydantic>=2.10",
|
|
30
|
-
"pdfplumber>=0.11",
|
|
30
|
+
"pdfplumber>=0.11.9",
|
|
31
31
|
"pypdfium2>=4.30",
|
|
32
32
|
"rapidfuzz>=3.9",
|
|
33
|
-
"fastapi>=0.
|
|
33
|
+
"fastapi>=0.133",
|
|
34
34
|
"uvicorn[standard]>=0.30",
|
|
35
|
-
"python-multipart>=0.0.
|
|
36
|
-
"typer>=0.
|
|
35
|
+
"python-multipart>=0.0.31",
|
|
36
|
+
"typer>=0.16",
|
|
37
37
|
"anthropic>=0.77",
|
|
38
|
+
# Not imported here: they parse what a stranger uploads (PDFs, multipart forms, HTTP) or
|
|
39
|
+
# the command line, and older releases have published advisories. These are the first
|
|
40
|
+
# without one (2026-10-02); the floors of pdfplumber, fastapi and typer above are the
|
|
41
|
+
# oldest that install beside them.
|
|
42
|
+
"pdfminer.six>=20251230",
|
|
43
|
+
"starlette>=1.3.1",
|
|
44
|
+
"click>=8.3.3",
|
|
38
45
|
]
|
|
39
46
|
|
|
40
47
|
[project.optional-dependencies]
|
|
41
|
-
ocr = ["pytesseract>=0.3.10", "Pillow>=
|
|
48
|
+
ocr = ["pytesseract>=0.3.10", "Pillow>=12.3"]
|
|
42
49
|
dev = [
|
|
43
|
-
"pytest>=
|
|
50
|
+
"pytest>=9.0.3",
|
|
44
51
|
"pytest-cov>=5.0",
|
|
45
52
|
"httpx>=0.27",
|
|
46
53
|
"ruff>=0.6",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
import sys
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import NoReturn
|
|
8
9
|
|
|
@@ -31,13 +32,30 @@ def _print_version(value: bool) -> None:
|
|
|
31
32
|
raise typer.Exit
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
def _text_streams() -> None:
|
|
36
|
+
"""Make stdout and stderr able to carry any text.
|
|
37
|
+
|
|
38
|
+
A pipe or a file gets UTF-8: before 3.15, Python on Windows gives it the system's code
|
|
39
|
+
page, where a file name outside it raised ``UnicodeEncodeError``. A terminal keeps its
|
|
40
|
+
own encoding and shows a character it cannot encode as an escape.
|
|
41
|
+
"""
|
|
42
|
+
for stream in (sys.stdout, sys.stderr):
|
|
43
|
+
reconfigure = getattr(stream, "reconfigure", None)
|
|
44
|
+
if reconfigure is None: # replaced by something that isn't a text file
|
|
45
|
+
continue
|
|
46
|
+
if stream.isatty():
|
|
47
|
+
reconfigure(errors="backslashreplace")
|
|
48
|
+
else:
|
|
49
|
+
reconfigure(encoding="utf-8")
|
|
50
|
+
|
|
51
|
+
|
|
34
52
|
@app.callback()
|
|
35
53
|
def _options(
|
|
36
54
|
version: bool = typer.Option(
|
|
37
55
|
False, "--version", callback=_print_version, is_eager=True, help="show the version and exit"
|
|
38
56
|
),
|
|
39
57
|
) -> None:
|
|
40
|
-
|
|
58
|
+
_text_streams()
|
|
41
59
|
|
|
42
60
|
|
|
43
61
|
def _fail(message: str, code: int = 1) -> NoReturn:
|
|
@@ -19,11 +19,20 @@ class ExtractionError(RuntimeError):
|
|
|
19
19
|
shape. The message is written for the person who supplied the file."""
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def _decode(content: bytes) -> str:
|
|
23
|
+
"""A JSON file's text as editors and shells on Windows save it: UTF-8, with or without a
|
|
24
|
+
byte-order mark (Notepad's "UTF-8 with BOM", PowerShell's `-Encoding utf8`), or UTF-16
|
|
25
|
+
with one (PowerShell's `>`)."""
|
|
26
|
+
if content.startswith((b"\xff\xfe", b"\xfe\xff")):
|
|
27
|
+
return content.decode("utf-16")
|
|
28
|
+
return content.decode("utf-8-sig")
|
|
29
|
+
|
|
30
|
+
|
|
22
31
|
def read_extraction_json(content: str | bytes, source: str) -> dict[str, Any]:
|
|
23
32
|
"""Parse a stored extraction (a fixture, or another tool's `result.json`).
|
|
24
33
|
`source` names the file in the error."""
|
|
25
34
|
try:
|
|
26
|
-
text = content
|
|
35
|
+
text = _decode(content) if isinstance(content, bytes) else content
|
|
27
36
|
raw = json.loads(text)
|
|
28
37
|
except UnicodeDecodeError as exc:
|
|
29
38
|
raise ExtractionError(f"{source} is not UTF-8 text") from exc
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fieldproof-0.2.1 → fieldproof-0.2.3}/src/fieldproof/server/static/assets/index-Bo892MpF.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|