diffpdf 1.1.0__tar.gz → 1.1.2__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.
Files changed (40) hide show
  1. {diffpdf-1.1.0 → diffpdf-1.1.2}/PKG-INFO +9 -2
  2. {diffpdf-1.1.0 → diffpdf-1.1.2}/README.md +8 -0
  3. {diffpdf-1.1.0 → diffpdf-1.1.2}/pyproject.toml +6 -2
  4. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/hash_check.py +1 -1
  5. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/text_check.py +1 -1
  6. diffpdf-1.1.2/tests/assets/fail/unicode-A.pdf +0 -0
  7. diffpdf-1.1.2/tests/assets/fail/unicode-B.pdf +0 -0
  8. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/test_api.py +2 -1
  9. diffpdf-1.1.2/uv.lock +865 -0
  10. diffpdf-1.1.0/uv.lock +0 -845
  11. {diffpdf-1.1.0 → diffpdf-1.1.2}/.github/dependabot.yml +0 -0
  12. {diffpdf-1.1.0 → diffpdf-1.1.2}/.github/workflows/build.yml +0 -0
  13. {diffpdf-1.1.0 → diffpdf-1.1.2}/.github/workflows/pypi-publish.yml +0 -0
  14. {diffpdf-1.1.0 → diffpdf-1.1.2}/.gitignore +0 -0
  15. {diffpdf-1.1.0 → diffpdf-1.1.2}/.pre-commit-config.yaml +0 -0
  16. {diffpdf-1.1.0 → diffpdf-1.1.2}/.vscode/extensions.json +0 -0
  17. {diffpdf-1.1.0 → diffpdf-1.1.2}/.vscode/settings.json +0 -0
  18. {diffpdf-1.1.0 → diffpdf-1.1.2}/LICENSE +0 -0
  19. {diffpdf-1.1.0 → diffpdf-1.1.2}/MANIFEST.in +0 -0
  20. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/__init__.py +0 -0
  21. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/cli.py +0 -0
  22. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/logger.py +0 -0
  23. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/page_check.py +0 -0
  24. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/py.typed +0 -0
  25. {diffpdf-1.1.0 → diffpdf-1.1.2}/src/diffpdf/visual_check.py +0 -0
  26. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/1-letter-diff-A.pdf +0 -0
  27. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/1-letter-diff-B.pdf +0 -0
  28. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/major-color-diff-A.pdf +0 -0
  29. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/major-color-diff-B.pdf +0 -0
  30. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/page-count-diff-A.pdf +0 -0
  31. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/fail/page-count-diff-B.pdf +0 -0
  32. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/hash-diff-A.pdf +0 -0
  33. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/hash-diff-B.pdf +0 -0
  34. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/identical-A.pdf +0 -0
  35. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/identical-B.pdf +0 -0
  36. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/minor-color-diff-A.pdf +0 -0
  37. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/minor-color-diff-B.pdf +0 -0
  38. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/multiplatform-diff-A.pdf +0 -0
  39. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/assets/pass/multiplatform-diff-B.pdf +0 -0
  40. {diffpdf-1.1.0 → diffpdf-1.1.2}/tests/test_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpdf
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
@@ -16,7 +16,6 @@ Requires-Python: >=3.10.0
16
16
  Requires-Dist: click>=8
17
17
  Requires-Dist: pillow>=10.0.0
18
18
  Requires-Dist: pixelmatch-fast>=1.3.1
19
- Requires-Dist: pre-commit>=4.5.1
20
19
  Requires-Dist: pymupdf>=1.23.0
21
20
  Description-Content-Type: text/markdown
22
21
 
@@ -84,6 +83,14 @@ diffpdf("reference.pdf", "actual.pdf")
84
83
  diffpdf("reference.pdf", "actual.pdf", output_dir="./output", dpi=300)
85
84
  ```
86
85
 
86
+ ## Cross-Platform Considerations
87
+
88
+ PDF rendering may differ slightly between platforms due to different font
89
+ rendering engines (ClearType on Windows, FreeType on Linux). DiffPDF's
90
+ default threshold accounts for these minor differences.
91
+
92
+ **Tip:** Generate reference PDFs on the same platform as your CI environment
93
+
87
94
  ## Development
88
95
 
89
96
  Install [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#installation). Then, install dependencies & activate the automatically generated virtual environment:
@@ -62,6 +62,14 @@ diffpdf("reference.pdf", "actual.pdf")
62
62
  diffpdf("reference.pdf", "actual.pdf", output_dir="./output", dpi=300)
63
63
  ```
64
64
 
65
+ ## Cross-Platform Considerations
66
+
67
+ PDF rendering may differ slightly between platforms due to different font
68
+ rendering engines (ClearType on Windows, FreeType on Linux). DiffPDF's
69
+ default threshold accounts for these minor differences.
70
+
71
+ **Tip:** Generate reference PDFs on the same platform as your CI environment
72
+
65
73
  ## Development
66
74
 
67
75
  Install [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#installation). Then, install dependencies & activate the automatically generated virtual environment:
@@ -26,7 +26,6 @@ dependencies = [
26
26
  "pymupdf>=1.23.0",
27
27
  "pixelmatch-fast>=1.3.1",
28
28
  "Pillow>=10.0.0",
29
- "pre-commit>=4.5.1",
30
29
  ]
31
30
 
32
31
  [project.urls]
@@ -39,6 +38,8 @@ dev = [
39
38
  "pytest-cov>=6",
40
39
  "ruff>=0.10",
41
40
  "ty>=0.0.8",
41
+ "pre-commit>=4.5.1",
42
+ "nodeenv>=1.4.0", # Required for pre-commit
42
43
  ]
43
44
 
44
45
  [project.scripts]
@@ -63,11 +64,14 @@ addopts = [
63
64
  ]
64
65
 
65
66
  [tool.ruff.lint]
67
+ preview = true
66
68
  extend-select = [
67
69
  "I", # Sort imports
68
70
  "ANN", # Enforce type annotations
69
71
  "PT", # Common style issues or inconsistencies with pytest-based tests
70
- ]
72
+ "PTH", # Use PathLib
73
+ "PLW1514", # Must specify file encoding
74
+ ]
71
75
 
72
76
  [tool.ruff.lint.isort]
73
77
  combine-as-imports = true # Combines "as" imports on the same line
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
 
5
5
  def compute_file_hash(filepath: Path) -> str:
6
6
  sha256 = hashlib.sha256()
7
- with open(filepath, "rb") as f:
7
+ with Path(filepath).open("rb") as f:
8
8
  for chunk in iter(lambda: f.read(8192), b""):
9
9
  sha256.update(chunk)
10
10
  return sha256.hexdigest()
@@ -46,7 +46,7 @@ def check_text_content(ref: Path, actual: Path, output_dir: Path | None) -> bool
46
46
  if output_dir is not None:
47
47
  output_dir.mkdir(parents=True, exist_ok=True)
48
48
  diff_file = output_dir / f"{ref.stem}_vs_{actual.stem}_text_diff.txt"
49
- diff_file.write_text(diff_text)
49
+ diff_file.write_text(diff_text, encoding="utf-8")
50
50
 
51
51
  logger.error(f"Text content mismatch:\n {diff_text}")
52
52
  return False
@@ -19,6 +19,7 @@ TEST_ASSETS_DIR = Path(__file__).parent / "assets"
19
19
  ("fail/1-letter-diff-A.pdf", "fail/1-letter-diff-B.pdf", False),
20
20
  ("fail/major-color-diff-A.pdf", "fail/major-color-diff-B.pdf", False),
21
21
  ("fail/page-count-diff-A.pdf", "fail/page-count-diff-B.pdf", False),
22
+ ("fail/unicode-A.pdf", "fail/unicode-B.pdf", False),
22
23
  ],
23
24
  )
24
25
  def test_api(ref_pdf_rel, actual_pdf_rel, should_pass):
@@ -39,4 +40,4 @@ def test_text_diff_output(tmp_path):
39
40
  assert result is False
40
41
  diff_file = tmp_path / "1-letter-diff-A_vs_1-letter-diff-B_text_diff.txt"
41
42
  assert diff_file.exists()
42
- assert diff_file.read_text()
43
+ assert diff_file.read_text(encoding="utf-8")