File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed
Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,10 @@ cmd = "pytest"
9393help = " Run tests"
9494
9595[tool .poe .tasks .test-perf ]
96- cmd = " pytest -m perf -v --benchmark-autosave --benchmark-histogram"
96+ sequence = [
97+ { cmd = " pytest -m perf -v --benchmark-autosave --benchmark-histogram" },
98+ { script = " scripts.rename_benchmark:main" },
99+ ]
97100help = " Run performance tests"
98101
99102[tool .poe .tasks .update-deps ]
Original file line number Diff line number Diff line change 1+ """Rename benchmark SVG files with version and timestamp suffix."""
2+
3+ import glob
4+ import re
5+ import shutil
6+ from pathlib import Path
7+
8+
9+ def main ():
10+ """Rename benchmark_*.svg to benchmark_v{version}_{timestamp}.svg."""
11+ # Read version from pyproject.toml
12+ pyproject = Path ("pyproject.toml" )
13+ if not pyproject .exists ():
14+ print ("pyproject.toml not found" )
15+ return
16+
17+ version = None
18+ for line in pyproject .read_text ().splitlines ():
19+ if line .startswith ("version = " ):
20+ version = line .split ('"' )[1 ]
21+ break
22+
23+ if not version :
24+ print ("Version not found in pyproject.toml" )
25+ return
26+
27+ # Rename SVG files
28+ for svg in glob .glob ("benchmark_*.svg" ):
29+ if not svg .startswith ("benchmark_v" ):
30+ # Extract timestamp from filename (e.g., benchmark_20251123_154214.svg)
31+ match = re .search (r"benchmark_(\d{8}_\d{6})\.svg" , svg )
32+ if match :
33+ timestamp = match .group (1 )
34+ new_name = f"benchmark_v{ version } _{ timestamp } .svg"
35+ else :
36+ new_name = f"benchmark_v{ version } .svg"
37+ shutil .move (svg , new_name )
38+ print (f"Renamed { svg } -> { new_name } " )
39+
40+
41+ if __name__ == "__main__" :
42+ main ()
You can’t perform that action at this time.
0 commit comments