diffpdf 1.1.2__tar.gz → 1.2.0__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.
- {diffpdf-1.1.2 → diffpdf-1.2.0}/PKG-INFO +2 -1
- {diffpdf-1.1.2 → diffpdf-1.2.0}/README.md +1 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/__init__.py +7 -3
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/cli.py +9 -1
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/test_api.py +18 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/test_cli.py +13 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/uv.lock +19 -19
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.github/dependabot.yml +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.github/workflows/build.yml +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.github/workflows/pypi-publish.yml +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.gitignore +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.pre-commit-config.yaml +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.vscode/extensions.json +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/.vscode/settings.json +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/LICENSE +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/MANIFEST.in +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/pyproject.toml +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/hash_check.py +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/logger.py +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/page_check.py +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/py.typed +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/text_check.py +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/src/diffpdf/visual_check.py +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/1-letter-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/1-letter-diff-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/major-color-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/major-color-diff-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/page-count-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/page-count-diff-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/unicode-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/fail/unicode-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/hash-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/hash-diff-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/identical-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/identical-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/minor-color-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/minor-color-diff-B.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/multiplatform-diff-A.pdf +0 -0
- {diffpdf-1.1.2 → diffpdf-1.2.0}/tests/assets/pass/multiplatform-diff-B.pdf +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffpdf
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A tool for comparing PDF files
|
|
5
5
|
Project-URL: Homepage, https://github.com/JustusRijke/DiffPDF
|
|
6
6
|
Project-URL: Issues, https://github.com/JustusRijke/DiffPDF/issues
|
|
@@ -61,6 +61,7 @@ Options:
|
|
|
61
61
|
--dpi INTEGER Render resolution
|
|
62
62
|
--output-dir DIRECTORY Diff output directory (saves text diffs and visual diff images on failure)
|
|
63
63
|
-v, --verbose Increase verbosity
|
|
64
|
+
--skip-compare-text Skip text content comparison
|
|
64
65
|
--version Show the version and exit.
|
|
65
66
|
--help Show this message and exit.
|
|
66
67
|
```
|
|
@@ -40,6 +40,7 @@ Options:
|
|
|
40
40
|
--dpi INTEGER Render resolution
|
|
41
41
|
--output-dir DIRECTORY Diff output directory (saves text diffs and visual diff images on failure)
|
|
42
42
|
-v, --verbose Increase verbosity
|
|
43
|
+
--skip-compare-text Skip text content comparison
|
|
43
44
|
--version Show the version and exit.
|
|
44
45
|
--help Show this message and exit.
|
|
45
46
|
```
|
|
@@ -17,6 +17,7 @@ def diffpdf(
|
|
|
17
17
|
dpi: int = 96,
|
|
18
18
|
output_dir: str | Path | None = None,
|
|
19
19
|
verbose: bool = False,
|
|
20
|
+
skip_compare_text: bool = False,
|
|
20
21
|
) -> bool:
|
|
21
22
|
ref_path = Path(reference) if isinstance(reference, str) else reference
|
|
22
23
|
actual_path = Path(actual) if isinstance(actual, str) else actual
|
|
@@ -34,9 +35,12 @@ def diffpdf(
|
|
|
34
35
|
if not check_page_counts(ref_path, actual_path):
|
|
35
36
|
return False
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if skip_compare_text:
|
|
39
|
+
logger.info("[3/4] Skipping text content check")
|
|
40
|
+
else:
|
|
41
|
+
logger.info("[3/4] Checking text content...")
|
|
42
|
+
if not check_text_content(ref_path, actual_path, out_path):
|
|
43
|
+
return False
|
|
40
44
|
|
|
41
45
|
logger.info("[4/4] Checking visual content...")
|
|
42
46
|
if not check_visual_content(ref_path, actual_path, threshold, dpi, out_path):
|
|
@@ -28,6 +28,11 @@ from .logger import setup_logging
|
|
|
28
28
|
is_flag=True,
|
|
29
29
|
help="Increase verbosity",
|
|
30
30
|
)
|
|
31
|
+
@click.option(
|
|
32
|
+
"--skip-compare-text",
|
|
33
|
+
is_flag=True,
|
|
34
|
+
help="Skip text content comparison (useful when different render engines produce identical-looking PDFs with different text extraction order)",
|
|
35
|
+
)
|
|
31
36
|
@click.version_option(package_name="diffpdf")
|
|
32
37
|
def cli(
|
|
33
38
|
reference: Path,
|
|
@@ -36,10 +41,13 @@ def cli(
|
|
|
36
41
|
dpi: int,
|
|
37
42
|
output_dir: Path | None,
|
|
38
43
|
verbose: bool,
|
|
44
|
+
skip_compare_text: bool,
|
|
39
45
|
) -> None:
|
|
40
46
|
"""Compare two PDF files for structural, textual, and visual differences."""
|
|
41
47
|
try:
|
|
42
|
-
if diffpdf(
|
|
48
|
+
if diffpdf(
|
|
49
|
+
reference, actual, threshold, dpi, output_dir, verbose, skip_compare_text
|
|
50
|
+
):
|
|
43
51
|
sys.exit(0)
|
|
44
52
|
else:
|
|
45
53
|
sys.exit(1)
|
|
@@ -31,6 +31,24 @@ def test_api(ref_pdf_rel, actual_pdf_rel, should_pass):
|
|
|
31
31
|
assert result == should_pass
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
def test_skip_compare_text():
|
|
35
|
+
ref_pdf = TEST_ASSETS_DIR / "fail/1-letter-diff-A.pdf"
|
|
36
|
+
actual_pdf = TEST_ASSETS_DIR / "fail/1-letter-diff-B.pdf"
|
|
37
|
+
|
|
38
|
+
# Without skip: fails at text stage
|
|
39
|
+
assert diffpdf(ref_pdf, actual_pdf) is False
|
|
40
|
+
# With skip: text stage bypassed, fails at visual stage (letter difference is visible)
|
|
41
|
+
assert diffpdf(ref_pdf, actual_pdf, skip_compare_text=True) is False
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_skip_compare_text_multiplatform():
|
|
45
|
+
ref_pdf = TEST_ASSETS_DIR / "pass/multiplatform-diff-A.pdf"
|
|
46
|
+
actual_pdf = TEST_ASSETS_DIR / "pass/multiplatform-diff-B.pdf"
|
|
47
|
+
|
|
48
|
+
# Multiplatform PDFs already pass with text comparison
|
|
49
|
+
assert diffpdf(ref_pdf, actual_pdf, skip_compare_text=True) is True
|
|
50
|
+
|
|
51
|
+
|
|
34
52
|
def test_text_diff_output(tmp_path):
|
|
35
53
|
ref_pdf = TEST_ASSETS_DIR / "fail/1-letter-diff-A.pdf"
|
|
36
54
|
actual_pdf = TEST_ASSETS_DIR / "fail/1-letter-diff-B.pdf"
|
|
@@ -20,6 +20,19 @@ def test_cli_with_output_dir():
|
|
|
20
20
|
assert Path("./diff").exists()
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
def test_skip_compare_text_flag():
|
|
24
|
+
runner = CliRunner()
|
|
25
|
+
result = runner.invoke(
|
|
26
|
+
cli,
|
|
27
|
+
[
|
|
28
|
+
str(TEST_ASSETS_DIR / "pass/multiplatform-diff-A.pdf"),
|
|
29
|
+
str(TEST_ASSETS_DIR / "pass/multiplatform-diff-B.pdf"),
|
|
30
|
+
"--skip-compare-text",
|
|
31
|
+
],
|
|
32
|
+
)
|
|
33
|
+
assert result.exit_code == 0
|
|
34
|
+
|
|
35
|
+
|
|
23
36
|
def test_verbose_flag():
|
|
24
37
|
runner = CliRunner()
|
|
25
38
|
result = runner.invoke(
|
|
@@ -206,7 +206,7 @@ name = "exceptiongroup"
|
|
|
206
206
|
version = "1.3.1"
|
|
207
207
|
source = { registry = "https://pypi.org/simple" }
|
|
208
208
|
dependencies = [
|
|
209
|
-
{ name = "typing-extensions", marker = "python_full_version < '3.
|
|
209
|
+
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
|
|
210
210
|
]
|
|
211
211
|
sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" }
|
|
212
212
|
wheels = [
|
|
@@ -818,26 +818,26 @@ wheels = [
|
|
|
818
818
|
|
|
819
819
|
[[package]]
|
|
820
820
|
name = "ty"
|
|
821
|
-
version = "0.0.
|
|
821
|
+
version = "0.0.17"
|
|
822
822
|
source = { registry = "https://pypi.org/simple" }
|
|
823
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
823
|
+
sdist = { url = "https://files.pythonhosted.org/packages/66/c3/41ae6346443eedb65b96761abfab890a48ce2aa5a8a27af69c5c5d99064d/ty-0.0.17.tar.gz", hash = "sha256:847ed6c120913e280bf9b54d8eaa7a1049708acb8824ad234e71498e8ad09f97", size = 5167209, upload-time = "2026-02-13T13:26:36.835Z" }
|
|
824
824
|
wheels = [
|
|
825
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
826
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
827
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
828
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
829
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
830
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
831
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
832
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
833
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
834
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
835
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
836
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
837
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
838
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
839
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
840
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
825
|
+
{ url = "https://files.pythonhosted.org/packages/c0/01/0ef15c22a1c54b0f728ceff3f62d478dbf8b0dcf8ff7b80b954f79584f3e/ty-0.0.17-py3-none-linux_armv6l.whl", hash = "sha256:64a9a16555cc8867d35c2647c2f1afbd3cae55f68fd95283a574d1bb04fe93e0", size = 10192793, upload-time = "2026-02-13T13:27:13.943Z" },
|
|
826
|
+
{ url = "https://files.pythonhosted.org/packages/0f/2c/f4c322d9cded56edc016b1092c14b95cf58c8a33b4787316ea752bb9418e/ty-0.0.17-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:eb2dbd8acd5c5a55f4af0d479523e7c7265a88542efe73ed3d696eb1ba7b6454", size = 10051977, upload-time = "2026-02-13T13:26:57.741Z" },
|
|
827
|
+
{ url = "https://files.pythonhosted.org/packages/4c/a5/43746c1ff81e784f5fc303afc61fe5bcd85d0fcf3ef65cb2cef78c7486c7/ty-0.0.17-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f18f5fd927bc628deb9ea2df40f06b5f79c5ccf355db732025a3e8e7152801f6", size = 9564639, upload-time = "2026-02-13T13:26:42.781Z" },
|
|
828
|
+
{ url = "https://files.pythonhosted.org/packages/d6/b8/280b04e14a9c0474af574f929fba2398b5e1c123c1e7735893b4cd73d13c/ty-0.0.17-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5383814d1d7a5cc53b3b07661856bab04bb2aac7a677c8d33c55169acdaa83df", size = 10061204, upload-time = "2026-02-13T13:27:00.152Z" },
|
|
829
|
+
{ url = "https://files.pythonhosted.org/packages/2a/d7/493e1607d8dfe48288d8a768a2adc38ee27ef50e57f0af41ff273987cda0/ty-0.0.17-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9c20423b8744b484f93e7bf2ef8a9724bca2657873593f9f41d08bd9f83444c9", size = 10013116, upload-time = "2026-02-13T13:26:34.543Z" },
|
|
830
|
+
{ url = "https://files.pythonhosted.org/packages/80/ef/22f3ed401520afac90dbdf1f9b8b7755d85b0d5c35c1cb35cf5bd11b59c2/ty-0.0.17-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e6f5b1aba97db9af86517b911674b02f5bc310750485dc47603a105bd0e83ddd", size = 10533623, upload-time = "2026-02-13T13:26:31.449Z" },
|
|
831
|
+
{ url = "https://files.pythonhosted.org/packages/75/ce/744b15279a11ac7138832e3a55595706b4a8a209c9f878e3ab8e571d9032/ty-0.0.17-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:488bce1a9bea80b851a97cd34c4d2ffcd69593d6c3f54a72ae02e5c6e47f3d0c", size = 11069750, upload-time = "2026-02-13T13:26:48.638Z" },
|
|
832
|
+
{ url = "https://files.pythonhosted.org/packages/f2/be/1133c91f15a0e00d466c24f80df486d630d95d1b2af63296941f7473812f/ty-0.0.17-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8df66b91ec84239420985ec215e7f7549bfda2ac036a3b3c065f119d1c06825a", size = 10870862, upload-time = "2026-02-13T13:26:54.715Z" },
|
|
833
|
+
{ url = "https://files.pythonhosted.org/packages/3e/4a/a2ed209ef215b62b2d3246e07e833081e07d913adf7e0448fc204be443d6/ty-0.0.17-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:002139e807c53002790dfefe6e2f45ab0e04012e76db3d7c8286f96ec121af8f", size = 10628118, upload-time = "2026-02-13T13:26:45.439Z" },
|
|
834
|
+
{ url = "https://files.pythonhosted.org/packages/b3/0c/87476004cb5228e9719b98afffad82c3ef1f84334bde8527bcacba7b18cb/ty-0.0.17-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6c4e01f05ce82e5d489ab3900ca0899a56c4ccb52659453780c83e5b19e2b64c", size = 10038185, upload-time = "2026-02-13T13:27:02.693Z" },
|
|
835
|
+
{ url = "https://files.pythonhosted.org/packages/46/4b/98f0b3ba9aef53c1f0305519536967a4aa793a69ed72677b0a625c5313ac/ty-0.0.17-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2b226dd1e99c0d2152d218c7e440150d1a47ce3c431871f0efa073bbf899e881", size = 10047644, upload-time = "2026-02-13T13:27:05.474Z" },
|
|
836
|
+
{ url = "https://files.pythonhosted.org/packages/93/e0/06737bb80aa1a9103b8651d2eb691a7e53f1ed54111152be25f4a02745db/ty-0.0.17-py3-none-musllinux_1_2_i686.whl", hash = "sha256:8b11f1da7859e0ad69e84b3c5ef9a7b055ceed376a432fad44231bdfc48061c2", size = 10231140, upload-time = "2026-02-13T13:27:10.844Z" },
|
|
837
|
+
{ url = "https://files.pythonhosted.org/packages/7c/79/e2a606bd8852383ba9abfdd578f4a227bd18504145381a10a5f886b4e751/ty-0.0.17-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:c04e196809ff570559054d3e011425fd7c04161529eb551b3625654e5f2434cb", size = 10718344, upload-time = "2026-02-13T13:26:51.66Z" },
|
|
838
|
+
{ url = "https://files.pythonhosted.org/packages/c5/2d/2663984ac11de6d78f74432b8b14ba64d170b45194312852b7543cf7fd56/ty-0.0.17-py3-none-win32.whl", hash = "sha256:305b6ed150b2740d00a817b193373d21f0767e10f94ac47abfc3b2e5a5aec809", size = 9672932, upload-time = "2026-02-13T13:27:08.522Z" },
|
|
839
|
+
{ url = "https://files.pythonhosted.org/packages/de/b5/39be78f30b31ee9f5a585969930c7248354db90494ff5e3d0756560fb731/ty-0.0.17-py3-none-win_amd64.whl", hash = "sha256:531828267527aee7a63e972f54e5eee21d9281b72baf18e5c2850c6b862add83", size = 10542138, upload-time = "2026-02-13T13:27:17.084Z" },
|
|
840
|
+
{ url = "https://files.pythonhosted.org/packages/40/b7/f875c729c5d0079640c75bad2c7e5d43edc90f16ba242f28a11966df8f65/ty-0.0.17-py3-none-win_arm64.whl", hash = "sha256:de9810234c0c8d75073457e10a84825b9cd72e6629826b7f01c7a0b266ae25b1", size = 10023068, upload-time = "2026-02-13T13:26:39.637Z" },
|
|
841
841
|
]
|
|
842
842
|
|
|
843
843
|
[[package]]
|
|
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
|
|
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
|