mdify-cli 2.9.0__tar.gz → 2.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.9.0
3
+ Version: 2.9.2
4
4
  Summary: Convert PDFs and document images into structured Markdown for LLM workflows
5
5
  Author: tiroq
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """mdify - Convert documents to Markdown via Docling container."""
2
2
 
3
- __version__ = "2.9.0"
3
+ __version__ = "2.9.2"
@@ -281,6 +281,27 @@ def check_image_exists(runtime: str, image: str) -> bool:
281
281
  True if image exists locally.
282
282
  """
283
283
  try:
284
+ runtime_name = os.path.basename(runtime)
285
+
286
+ # Apple Container uses 'image list' command (two words)
287
+ if runtime_name == "container":
288
+ result = subprocess.run(
289
+ [runtime, "image", "list", "--format", "json"],
290
+ capture_output=True,
291
+ check=False,
292
+ )
293
+ if result.returncode == 0 and result.stdout:
294
+ try:
295
+ images = json.loads(result.stdout.decode())
296
+ # Check if image exists in the list
297
+ for img in images:
298
+ if img.get("name") == image or image in img.get("repoTags", []):
299
+ return True
300
+ except json.JSONDecodeError:
301
+ pass
302
+ return False
303
+
304
+ # Docker/Podman/OrbStack/Colima use standard 'image inspect'
284
305
  result = subprocess.run(
285
306
  [runtime, "image", "inspect", image],
286
307
  capture_output=True,
@@ -307,6 +328,18 @@ def pull_image(runtime: str, image: str, quiet: bool = False) -> bool:
307
328
  print(f"Pulling image: {image}")
308
329
 
309
330
  try:
331
+ runtime_name = os.path.basename(runtime)
332
+
333
+ # Apple Container uses 'image pull' command (two words)
334
+ if runtime_name == "container":
335
+ result = subprocess.run(
336
+ [runtime, "image", "pull", image],
337
+ capture_output=quiet,
338
+ check=False,
339
+ )
340
+ return result.returncode == 0
341
+
342
+ # Docker/Podman/OrbStack/Colima use standard 'pull'
310
343
  result = subprocess.run(
311
344
  [runtime, "pull", image],
312
345
  capture_output=quiet,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.9.0
3
+ Version: 2.9.2
4
4
  Summary: Convert PDFs and document images into structured Markdown for LLM workflows
5
5
  Author: tiroq
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mdify-cli"
3
- version = "2.9.0"
3
+ version = "2.9.2"
4
4
  description = "Convert PDFs and document images into structured Markdown for LLM workflows"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
@@ -978,6 +978,47 @@ class TestContainerRuntime:
978
978
  captured = capsys.readouterr()
979
979
  assert "Error pulling image" in captured.err
980
980
 
981
+ def test_apple_container_pull_success(self):
982
+ """Test pull_image uses 'image-pull' for Apple Container."""
983
+ mock_result = Mock()
984
+ mock_result.returncode = 0
985
+ with patch("mdify.cli.subprocess.run", return_value=mock_result) as mock_run:
986
+ result = pull_image("/usr/local/bin/container", "test-image", quiet=True)
987
+ assert result is True
988
+ mock_run.assert_called_once_with(
989
+ ["/usr/local/bin/container", "image-pull", "test-image"],
990
+ capture_output=True,
991
+ check=False,
992
+ )
993
+
994
+ def test_apple_container_image_exists(self):
995
+ """Test check_image_exists uses 'image-list' for Apple Container."""
996
+ mock_result = Mock()
997
+ mock_result.returncode = 0
998
+ mock_result.stdout = json.dumps([
999
+ {"name": "test-image", "repoTags": ["test-image:latest"]},
1000
+ {"name": "other-image", "repoTags": ["other-image:latest"]}
1001
+ ]).encode()
1002
+ with patch("mdify.cli.subprocess.run", return_value=mock_result) as mock_run:
1003
+ result = check_image_exists("/usr/local/bin/container", "test-image")
1004
+ assert result is True
1005
+ mock_run.assert_called_once_with(
1006
+ ["/usr/local/bin/container", "image-list", "--format", "json"],
1007
+ capture_output=True,
1008
+ check=False,
1009
+ )
1010
+
1011
+ def test_apple_container_image_not_exists(self):
1012
+ """Test check_image_exists returns False when image not in list."""
1013
+ mock_result = Mock()
1014
+ mock_result.returncode = 0
1015
+ mock_result.stdout = json.dumps([
1016
+ {"name": "other-image", "repoTags": ["other-image:latest"]}
1017
+ ]).encode()
1018
+ with patch("mdify.cli.subprocess.run", return_value=mock_result):
1019
+ result = check_image_exists("/usr/local/bin/container", "test-image")
1020
+ assert result is False
1021
+
981
1022
 
982
1023
  class TestGetStorageRoot:
983
1024
  """Tests for get_storage_root() function."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes