mdify-cli 2.9.5__tar.gz → 2.10.1__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.
- {mdify_cli-2.9.5/mdify_cli.egg-info → mdify_cli-2.10.1}/PKG-INFO +1 -1
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify/__init__.py +1 -1
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify/cli.py +26 -4
- {mdify_cli-2.9.5 → mdify_cli-2.10.1/mdify_cli.egg-info}/PKG-INFO +1 -1
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/pyproject.toml +1 -1
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/tests/test_cli.py +19 -5
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/LICENSE +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/README.md +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/assets/mdify.png +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify/__main__.py +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify/container.py +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify/docling_client.py +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify_cli.egg-info/SOURCES.txt +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify_cli.egg-info/dependency_links.txt +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify_cli.egg-info/entry_points.txt +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify_cli.egg-info/requires.txt +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/mdify_cli.egg-info/top_level.txt +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/setup.cfg +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/tests/test_container.py +0 -0
- {mdify_cli-2.9.5 → mdify_cli-2.10.1}/tests/test_docling_client.py +0 -0
|
@@ -294,8 +294,10 @@ def check_image_exists(runtime: str, image: str) -> bool:
|
|
|
294
294
|
try:
|
|
295
295
|
images = json.loads(result.stdout.decode())
|
|
296
296
|
# Check if image exists in the list
|
|
297
|
+
# Apple Container returns format: [{"reference": "image:tag", "descriptor": {...}}]
|
|
297
298
|
for img in images:
|
|
298
|
-
|
|
299
|
+
reference = img.get("reference", "")
|
|
300
|
+
if reference == image or reference.startswith(f"{image}:"):
|
|
299
301
|
return True
|
|
300
302
|
except json.JSONDecodeError:
|
|
301
303
|
pass
|
|
@@ -521,8 +523,8 @@ class Spinner:
|
|
|
521
523
|
self.running = False
|
|
522
524
|
if self.thread:
|
|
523
525
|
self.thread.join(timeout=0.5)
|
|
524
|
-
# Clear the spinner line
|
|
525
|
-
print(f"\r{' ' *
|
|
526
|
+
# Clear the spinner line with enough spaces to cover the longest possible line
|
|
527
|
+
print(f"\r{' ' * 120}\r", end="", flush=True)
|
|
526
528
|
|
|
527
529
|
|
|
528
530
|
# =============================================================================
|
|
@@ -813,6 +815,10 @@ def main() -> int:
|
|
|
813
815
|
|
|
814
816
|
image_exists = check_image_exists(runtime, image)
|
|
815
817
|
|
|
818
|
+
if not args.quiet and image_exists:
|
|
819
|
+
print(f"Using cached image: {image}")
|
|
820
|
+
print()
|
|
821
|
+
|
|
816
822
|
# NOTE: Docker Desktop on macOS/Windows uses a VM, so disk space checks may not
|
|
817
823
|
# accurately reflect available space in the container's filesystem. Remote Docker
|
|
818
824
|
# daemons (DOCKER_HOST) are also not supported. In these cases, the check will
|
|
@@ -982,6 +988,7 @@ def main() -> int:
|
|
|
982
988
|
)
|
|
983
989
|
elapsed = time.time() - start_time
|
|
984
990
|
|
|
991
|
+
# Stop spinner before any output
|
|
985
992
|
if not args.quiet:
|
|
986
993
|
spinner.stop()
|
|
987
994
|
|
|
@@ -1004,12 +1011,27 @@ def main() -> int:
|
|
|
1004
1011
|
except Exception as e:
|
|
1005
1012
|
elapsed = time.time() - start_time
|
|
1006
1013
|
failed_count += 1
|
|
1014
|
+
# Stop spinner before printing error
|
|
1007
1015
|
if not args.quiet:
|
|
1008
1016
|
spinner.stop()
|
|
1017
|
+
|
|
1018
|
+
# Check if container is still healthy
|
|
1019
|
+
error_msg = str(e)
|
|
1020
|
+
if "Connection refused" in error_msg or "Connection aborted" in error_msg or "RemoteDisconnected" in error_msg:
|
|
1021
|
+
if not container.is_ready():
|
|
1022
|
+
if not args.quiet:
|
|
1023
|
+
print(
|
|
1024
|
+
f"{progress} {input_file.name} ✗ ({format_duration(elapsed)})"
|
|
1025
|
+
)
|
|
1026
|
+
print(f" Error: Container crashed (file may be too complex or large)", file=sys.stderr)
|
|
1027
|
+
print(f" Stopping remaining conversions", file=sys.stderr)
|
|
1028
|
+
break
|
|
1029
|
+
|
|
1030
|
+
if not args.quiet:
|
|
1009
1031
|
print(
|
|
1010
1032
|
f"{progress} {input_file.name} ✗ ({format_duration(elapsed)})"
|
|
1011
1033
|
)
|
|
1012
|
-
print(f" Error: {
|
|
1034
|
+
print(f" Error: {error_msg}", file=sys.stderr)
|
|
1013
1035
|
|
|
1014
1036
|
total_elapsed = time.time() - conversion_start
|
|
1015
1037
|
|
|
@@ -995,12 +995,19 @@ class TestContainerRuntime:
|
|
|
995
995
|
"""Test check_image_exists uses 'image list' for Apple Container."""
|
|
996
996
|
mock_result = Mock()
|
|
997
997
|
mock_result.returncode = 0
|
|
998
|
+
# Use actual Apple Container response format with 'reference' field
|
|
998
999
|
mock_result.stdout = json.dumps([
|
|
999
|
-
{
|
|
1000
|
-
|
|
1000
|
+
{
|
|
1001
|
+
"reference": "ghcr.io/docling-project/docling-serve-cpu:main",
|
|
1002
|
+
"descriptor": {
|
|
1003
|
+
"size": 1609,
|
|
1004
|
+
"mediaType": "application/vnd.oci.image.index.v1+json",
|
|
1005
|
+
"digest": "sha256:25e82dfa30371d17a0af17edc42261a4b9bedb37f0f337887c366184bc3ee291"
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1001
1008
|
]).encode()
|
|
1002
1009
|
with patch("mdify.cli.subprocess.run", return_value=mock_result) as mock_run:
|
|
1003
|
-
result = check_image_exists("/usr/local/bin/container", "
|
|
1010
|
+
result = check_image_exists("/usr/local/bin/container", "ghcr.io/docling-project/docling-serve-cpu:main")
|
|
1004
1011
|
assert result is True
|
|
1005
1012
|
mock_run.assert_called_once_with(
|
|
1006
1013
|
["/usr/local/bin/container", "image", "list", "--format", "json"],
|
|
@@ -1013,10 +1020,17 @@ class TestContainerRuntime:
|
|
|
1013
1020
|
mock_result = Mock()
|
|
1014
1021
|
mock_result.returncode = 0
|
|
1015
1022
|
mock_result.stdout = json.dumps([
|
|
1016
|
-
{
|
|
1023
|
+
{
|
|
1024
|
+
"reference": "ghcr.io/other-project/other-image:latest",
|
|
1025
|
+
"descriptor": {
|
|
1026
|
+
"size": 1234,
|
|
1027
|
+
"mediaType": "application/vnd.oci.image.index.v1+json",
|
|
1028
|
+
"digest": "sha256:abcd1234"
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1017
1031
|
]).encode()
|
|
1018
1032
|
with patch("mdify.cli.subprocess.run", return_value=mock_result):
|
|
1019
|
-
result = check_image_exists("/usr/local/bin/container", "
|
|
1033
|
+
result = check_image_exists("/usr/local/bin/container", "ghcr.io/docling-project/docling-serve-cpu:main")
|
|
1020
1034
|
assert result is False
|
|
1021
1035
|
|
|
1022
1036
|
|
|
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
|