File tree 6 files changed +12
-6
lines changed
6 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
- __version__ = "0.3.4 "
1
+ __version__ = "0.3.5 "
Original file line number Diff line number Diff line change 3
3
import subprocess
4
4
from pathlib import Path
5
5
6
- __version__ = "0.3.4 "
6
+ __version__ = "0.3.5 "
7
7
8
8
CACHE_FOLDER = Path .home () / ".cache" / "babeldoc"
9
9
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ def do_translate(
381
381
original_pdf_path = translation_config .input_file
382
382
logger .info (f"start to translate: { original_pdf_path } " )
383
383
start_time = time .time ()
384
-
384
+ peak_memory_usage = 0
385
385
with MemoryMonitor () as memory_monitor :
386
386
# Check if split translation is enabled
387
387
if not translation_config .split_strategy :
@@ -504,6 +504,7 @@ def do_translate(
504
504
logger .info ("start merge results" )
505
505
result = merger .merge_results (results )
506
506
logger .info ("finish merge results" )
507
+ peak_memory_usage = memory_monitor .peak_memory_usage
507
508
508
509
finish_time = time .time ()
509
510
result .total_seconds = finish_time - start_time
@@ -512,6 +513,7 @@ def do_translate(
512
513
f"finish translate: { original_pdf_path } , cost: { finish_time - start_time } s" ,
513
514
)
514
515
result .original_pdf_path = translation_config .input_file
516
+ result .peak_memory_usage = peak_memory_usage
515
517
pm .translate_done (result )
516
518
return result
517
519
Original file line number Diff line number Diff line change 23
23
from babeldoc .translation_config import WatermarkOutputMode
24
24
25
25
logger = logging .getLogger (__name__ )
26
- __version__ = "0.3.4 "
26
+ __version__ = "0.3.5 "
27
27
28
28
29
29
def create_parser ():
Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ class TranslateResult:
256
256
dual_pdf_path : str | None
257
257
no_watermark_mono_pdf_path : str | None
258
258
no_watermark_dual_pdf_path : str | None
259
+ peak_memory_usage : int | None
259
260
260
261
def __init__ (self , mono_pdf_path : str | None , dual_pdf_path : str | None ):
261
262
self .mono_pdf_path = mono_pdf_path
@@ -299,6 +300,9 @@ def __str__(self):
299
300
f"\t No-watermark Dual-language PDF: { self .no_watermark_dual_pdf_path } "
300
301
)
301
302
303
+ if hasattr (self , "peak_memory_usage" ) and self .peak_memory_usage :
304
+ result .append (f"\t Peak memory usage: { self .peak_memory_usage } MB" )
305
+
302
306
if result :
303
307
result .insert (0 , "Translation results:" )
304
308
Original file line number Diff line number Diff line change 1
1
[project ]
2
2
name = " BabelDOC"
3
- version = " 0.3.4 "
3
+ version = " 0.3.5 "
4
4
description = " Yet Another Document Translator"
5
5
license = " AGPL-3.0"
6
6
readme = " README.md"
@@ -148,7 +148,7 @@ pythonpath = [".", "src"]
148
148
testpaths = [" tests" ]
149
149
150
150
[bumpver ]
151
- current_version = " 0.3.4 "
151
+ current_version = " 0.3.5 "
152
152
version_pattern = " MAJOR.MINOR.PATCH[.PYTAGNUM]"
153
153
154
154
[bumpver .file_patterns ]
You can’t perform that action at this time.
0 commit comments