mdify-cli 2.10.1__tar.gz → 2.11.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.10.1
3
+ Version: 2.11.0
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.10.1"
3
+ __version__ = "2.11.0"
@@ -38,6 +38,9 @@ SUPPORTED_RUNTIMES = ("docker", "podman", "orbstack", "colima", "container")
38
38
  MACOS_RUNTIMES_PRIORITY = ("container", "orbstack", "colima", "podman", "docker")
39
39
  OTHER_RUNTIMES_PRIORITY = ("docker", "podman")
40
40
 
41
+ # Debug mode
42
+ DEBUG = os.environ.get("MDIFY_DEBUG", "").lower() in ("1", "true", "yes")
43
+
41
44
 
42
45
  # =============================================================================
43
46
  # Update checking functions
@@ -983,6 +986,9 @@ def main() -> int:
983
986
  start_time = time.time()
984
987
  try:
985
988
  # Convert via HTTP API
989
+ if DEBUG:
990
+ print(f" DEBUG: Converting {input_file.name} via {container.base_url}/v1/convert/file", file=sys.stderr)
991
+
986
992
  result = convert_file(
987
993
  container.base_url, input_file, to_format="md"
988
994
  )
@@ -1023,7 +1029,15 @@ def main() -> int:
1023
1029
  print(
1024
1030
  f"{progress} {input_file.name} ✗ ({format_duration(elapsed)})"
1025
1031
  )
1026
- print(f" Error: Container crashed (file may be too complex or large)", file=sys.stderr)
1032
+ print(f" Error: Container crashed while processing file", file=sys.stderr)
1033
+ print(f" File may be too complex, large, or malformed", file=sys.stderr)
1034
+ print(f" Retrieving container logs...", file=sys.stderr)
1035
+ # Get last 20 lines of container logs for debugging
1036
+ logs = container.get_logs(tail=20)
1037
+ if logs:
1038
+ print(f" Container logs (last 20 lines):", file=sys.stderr)
1039
+ for line in logs.strip().split('\n'):
1040
+ print(f" {line}", file=sys.stderr)
1027
1041
  print(f" Stopping remaining conversions", file=sys.stderr)
1028
1042
  break
1029
1043
 
@@ -125,6 +125,48 @@ class DoclingContainer:
125
125
  check=False,
126
126
  )
127
127
 
128
+ def get_logs(self, tail: int = 50) -> str:
129
+ """Get container logs for debugging.
130
+
131
+ Args:
132
+ tail: Number of lines to retrieve from end of logs
133
+
134
+ Returns:
135
+ Container logs as string
136
+ """
137
+ if not self.container_name:
138
+ return ""
139
+
140
+ try:
141
+ result = subprocess.run(
142
+ [self.runtime, "logs", "--tail", str(tail), self.container_name],
143
+ capture_output=True,
144
+ text=True,
145
+ check=False,
146
+ )
147
+ return result.stdout if result.returncode == 0 else ""
148
+ except Exception:
149
+ return ""
150
+
151
+ def is_running(self) -> bool:
152
+ """Check if container process is still running.
153
+
154
+ Returns:
155
+ True if container is running, False otherwise
156
+ """
157
+ if not self.container_name:
158
+ return False
159
+
160
+ try:
161
+ result = subprocess.run(
162
+ [self.runtime, "ps", "-q", "-f", f"name={self.container_name}"],
163
+ capture_output=True,
164
+ check=False,
165
+ )
166
+ return result.returncode == 0 and bool(result.stdout.strip())
167
+ except Exception:
168
+ return False
169
+
128
170
  def is_ready(self) -> bool:
129
171
  """Check if container is healthy.
130
172
 
@@ -132,6 +174,10 @@ class DoclingContainer:
132
174
  True if container is healthy, False otherwise
133
175
  """
134
176
  try:
177
+ # First check if container is still running
178
+ if not self.is_running():
179
+ return False
180
+ # Then check health endpoint
135
181
  return check_health(self.base_url)
136
182
  except Exception:
137
183
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.10.1
3
+ Version: 2.11.0
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.10.1"
3
+ version = "2.11.0"
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"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes