diff --git a/symforce/codegen/codegen_util.py b/symforce/codegen/codegen_util.py index 440c53f0..8165489f 100644 --- a/symforce/codegen/codegen_util.py +++ b/symforce/codegen/codegen_util.py @@ -772,7 +772,8 @@ def generate_lcm_types( ) # Autoformat generated python files - format_util.format_py_dir(python_types_dir) + for f in python_types_dir.rglob("*.py"): + f.write_text(format_util.format_py(f.read_text(), str(Path(__file__).parent / f.name))) return result diff --git a/symforce/codegen/format_util.py b/symforce/codegen/format_util.py index 558f1193..3c4a360e 100644 --- a/symforce/codegen/format_util.py +++ b/symforce/codegen/format_util.py @@ -91,21 +91,6 @@ def format_py(file_contents: str, filename: str) -> str: return result.stdout -def format_py_dir(dirname: T.Openable) -> None: - """ - Autoformat python files in a directory (recursively) in-place - """ - subprocess.run( - [find_ruff_bin(), "format", dirname], - check=True, - # Disable the ruff cache. This is important for running in a hermetic context like a bazel - # test, and shouldn't really hurt other use cases. If it does, we should work around this - # differently. - env=dict(os.environ, RUFF_NO_CACHE="true"), - text=True, - ) - - _rustfmt_path: T.Optional[Path] = None