Skip to content

Commit 040857f

Browse files
author
iscai-msft
committed
speed up batch black processing
1 parent 8f4d23f commit 040857f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/http-client-python/eng/scripts/setup/run_batch.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,15 @@ def update_progress():
174174
# Run black formatting after all codegen completes. Running black separately
175175
# avoids duplicating black's import/startup cost in each worker process.
176176
if output_dirs:
177-
from pygen.black import BlackScriptPlugin
177+
import subprocess
178178

179179
print(f"Formatting {len(output_dirs)} packages with black...")
180-
for d in output_dirs:
181-
BlackScriptPlugin(output_folder=d).process()
180+
# Use black CLI with all directories at once — black handles parallelism internally.
181+
# This is much faster than calling format_file_contents() per-file sequentially.
182+
subprocess.run(
183+
[sys.executable, "-m", "black", "--line-length", "120", "--fast", "--quiet"] + output_dirs,
184+
check=True,
185+
)
182186

183187

184188
if __name__ == "__main__":

0 commit comments

Comments
 (0)