pdflinkcheck 1.1.94__py3-none-any.whl → 1.2.29__py3-none-any.whl
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.
- pdflinkcheck/__init__.py +88 -18
- pdflinkcheck/__main__.py +6 -0
- pdflinkcheck/analysis_pdfium.py +131 -0
- pdflinkcheck/{analyze_pymupdf.py → analysis_pymupdf.py} +99 -141
- pdflinkcheck/{analyze_pypdf.py → analysis_pypdf.py} +51 -39
- pdflinkcheck/cli.py +52 -48
- pdflinkcheck/data/LICENSE +18 -15
- pdflinkcheck/data/README.md +23 -25
- pdflinkcheck/data/pyproject.toml +17 -26
- pdflinkcheck/datacopy.py +16 -1
- pdflinkcheck/dev.py +2 -2
- pdflinkcheck/environment.py +14 -2
- pdflinkcheck/gui.py +346 -563
- pdflinkcheck/helpers.py +88 -0
- pdflinkcheck/io.py +24 -6
- pdflinkcheck/report.py +598 -97
- pdflinkcheck/security.py +189 -0
- pdflinkcheck/splash.py +38 -0
- pdflinkcheck/stdlib_server.py +7 -21
- pdflinkcheck/stdlib_server_alt.py +571 -0
- pdflinkcheck/tk_utils.py +188 -0
- pdflinkcheck/update_msix_version.py +2 -0
- pdflinkcheck/validate.py +104 -170
- pdflinkcheck/version_info.py +2 -2
- {pdflinkcheck-1.1.94.dist-info → pdflinkcheck-1.2.29.dist-info}/METADATA +41 -40
- {pdflinkcheck-1.1.94.dist-info → pdflinkcheck-1.2.29.dist-info}/RECORD +34 -27
- pdflinkcheck-1.2.29.dist-info/WHEEL +5 -0
- {pdflinkcheck-1.1.94.dist-info → pdflinkcheck-1.2.29.dist-info}/entry_points.txt +0 -1
- pdflinkcheck-1.2.29.dist-info/licenses/LICENSE +27 -0
- pdflinkcheck-1.2.29.dist-info/top_level.txt +1 -0
- pdflinkcheck/analyze_pypdf_v2.py +0 -217
- pdflinkcheck-1.1.94.dist-info/WHEEL +0 -4
- pdflinkcheck-1.1.94.dist-info/licenses/LICENSE +0 -24
- {pdflinkcheck-1.1.94.dist-info → pdflinkcheck-1.2.29.dist-info}/licenses/LICENSE-AGPL3 +0 -0
- {pdflinkcheck-1.1.94.dist-info → pdflinkcheck-1.2.29.dist-info}/licenses/LICENSE-MIT +0 -0
pdflinkcheck/datacopy.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
3
|
# src/pdflinkcheck/datacopy.py
|
|
4
|
+
from __future__ import annotations
|
|
4
5
|
import shutil
|
|
5
6
|
import sys
|
|
6
7
|
from pathlib import Path
|
|
8
|
+
import importlib.resources as resources
|
|
7
9
|
|
|
8
10
|
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
|
|
9
11
|
|
|
@@ -58,5 +60,18 @@ def ensure_data_files_for_build():
|
|
|
58
60
|
ensure_package_readme(PROJECT_ROOT, PROJECT_ROOT)
|
|
59
61
|
ensure_package_pyproject(PROJECT_ROOT, PROJECT_ROOT)
|
|
60
62
|
|
|
63
|
+
|
|
64
|
+
def get_data_root() -> Path:
|
|
65
|
+
"""
|
|
66
|
+
Returns the path to the 'data' directory bundled with pdflinkcheck.
|
|
67
|
+
Works for both source code and installed package.
|
|
68
|
+
"""
|
|
69
|
+
try:
|
|
70
|
+
# Python ≥3.9: use importlib.resources.files
|
|
71
|
+
return resources.files("pdflinkcheck") / "data"
|
|
72
|
+
except Exception:
|
|
73
|
+
# Fallback: assume running from source
|
|
74
|
+
return Path(__file__).resolve().parent / "data"
|
|
75
|
+
|
|
61
76
|
if __name__ == "__main__":
|
|
62
|
-
ensure_data_files_for_build()
|
|
77
|
+
ensure_data_files_for_build()
|
pdflinkcheck/dev.py
CHANGED
|
@@ -19,7 +19,7 @@ import pdflinkcheck
|
|
|
19
19
|
subprocess.run("pdflinkcheck", "help-tree")
|
|
20
20
|
```
|
|
21
21
|
"""
|
|
22
|
-
|
|
22
|
+
from __future__ import annotations
|
|
23
23
|
import typer
|
|
24
24
|
from rich.tree import Tree
|
|
25
25
|
from rich.panel import Panel
|
|
@@ -49,7 +49,7 @@ def add_typer_help_tree(app,
|
|
|
49
49
|
for command_name in sorted(root_app_command.commands.keys()):
|
|
50
50
|
command = root_app_command.commands[command_name]
|
|
51
51
|
|
|
52
|
-
if command.name == "tree
|
|
52
|
+
if command.name == "help-tree":
|
|
53
53
|
continue
|
|
54
54
|
|
|
55
55
|
help_text = command.help.splitlines()[0].strip() if command.help else "No help available."
|
pdflinkcheck/environment.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
3
|
# pdflinkcheck/environment.py
|
|
4
|
-
|
|
4
|
+
from __future__ import annotations
|
|
5
5
|
from functools import cache
|
|
6
6
|
import subprocess
|
|
7
7
|
"""
|
|
@@ -30,6 +30,18 @@ def pymupdf_is_available() -> bool:
|
|
|
30
30
|
# Use: `pipx install pdflinkcheck[full]` or alternative.
|
|
31
31
|
return False
|
|
32
32
|
|
|
33
|
+
@cache
|
|
34
|
+
def pdfium_is_available() -> bool:
|
|
35
|
+
"""Check if pdfium2 is available in the current local version of pdflinkcheck."""
|
|
36
|
+
try:
|
|
37
|
+
import pypdfium2
|
|
38
|
+
return True
|
|
39
|
+
except Exception:
|
|
40
|
+
# Fails if: the [full] group from [project.optional-dependencies] in pyrpoject.toml was not used when installing pdflink check. Like
|
|
41
|
+
# Use: `pipx install pdflinkcheck[pdfium]` or alternative.
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
|
|
33
45
|
|
|
34
46
|
@cache
|
|
35
47
|
def is_in_git_repo(path='.'):
|
|
@@ -61,4 +73,4 @@ def assess_default_pdf_library():
|
|
|
61
73
|
if pymupdf_is_available():
|
|
62
74
|
return "pymupdf"
|
|
63
75
|
else:
|
|
64
|
-
return "pypdf"
|
|
76
|
+
return "pypdf"
|