@@ -83,23 +83,26 @@ def included_workspace_files(
8383 """
8484 included : list [Path ] = []
8585 ws_str = str (workspace .resolve ())
86-
86+
8787 # Prune list for os.walk
8888 prune_dirs = {".git" , ".ark" , "__pycache__" , "venv" , ".venv" , "build" , "dist" }
89-
89+
9090 import os
91+
9192 for root , dirs , files in os .walk (ws_str ):
9293 # 1. Early pruning of common heavy/system directories
9394 dirs [:] = [d for d in dirs if d not in prune_dirs ]
94-
95+
9596 # 2. Apply custom exclude patterns to directories
9697 rel_root = os .path .relpath (root , ws_str )
9798 if rel_root == "." :
9899 rel_root = ""
99-
100+
100101 if rel_root :
101- if any (_matches_exclude_pattern (rel_root + "/" , p ) for p in exclude_patterns ):
102- dirs [:] = [] # Stop recursion here
102+ if any (
103+ _matches_exclude_pattern (rel_root + "/" , p ) for p in exclude_patterns
104+ ):
105+ dirs [:] = [] # Stop recursion here
103106 continue
104107
105108 # 3. Process files
@@ -108,7 +111,7 @@ def included_workspace_files(
108111 if any (_matches_exclude_pattern (rel_path , p ) for p in exclude_patterns ):
109112 continue
110113 included .append (Path (root ) / f )
111-
114+
112115 return sorted (included )
113116
114117
@@ -131,13 +134,14 @@ def get_git_commit_hash(workspace: Path) -> str | None:
131134 """Return the current Git commit hash of the workspace if available."""
132135 try :
133136 import subprocess
137+
134138 result = subprocess .run (
135139 ["git" , "rev-parse" , "HEAD" ],
136140 cwd = str (workspace ),
137141 capture_output = True ,
138142 text = True ,
139143 timeout = 5 ,
140- check = True
144+ check = True ,
141145 )
142146 return result .stdout .strip ()
143147 except Exception :
@@ -148,13 +152,14 @@ def get_git_branch(workspace: Path) -> str | None:
148152 """Return the current Git branch of the workspace if available."""
149153 try :
150154 import subprocess
155+
151156 result = subprocess .run (
152157 ["git" , "rev-parse" , "--abbrev-ref" , "HEAD" ],
153158 cwd = str (workspace ),
154159 capture_output = True ,
155160 text = True ,
156161 timeout = 5 ,
157- check = True
162+ check = True ,
158163 )
159164 return result .stdout .strip ()
160165 except Exception :
@@ -163,6 +168,7 @@ def get_git_branch(workspace: Path) -> str | None:
163168
164169def next_build_id (lock_dir : Path ) -> str :
165170 from datetime import UTC
171+
166172 today = datetime .now (UTC ).strftime ("%Y_%m_%d" )
167173 prefix = f"ARK_{ today } _"
168174 seq = 1
@@ -193,7 +199,7 @@ def build_lock_payload(
193199 build_id = next_build_id (lock_dir )
194200 git_commit = get_git_commit_hash (workspace )
195201 git_branch = get_git_branch (workspace )
196-
202+
197203 return {
198204 "build_id" : build_id ,
199205 "project" : {
@@ -279,7 +285,7 @@ def build_context_from_lock(lock_payload: dict[str, Any]) -> BuildContext:
279285 project = lock_payload .get ("project" ) or {}
280286 build = lock_payload .get ("build" ) or {}
281287 workspace_cfg = lock_payload .get ("workspace" ) or {}
282-
288+
283289 # Check build.exclude (new) then workspace.exclude_patterns (legacy)
284290 exclude_patterns = list (build .get ("exclude" ) or [])
285291 if not exclude_patterns :
0 commit comments