From 00816cc8ef4cb72728a1728b80b24bdadc0d080f Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Wed, 20 Nov 2024 13:55:43 -0800 Subject: [PATCH] make sure codegen doesn't cause spurious diffs for no reason --- llama_stack/scripts/distro_codegen.py | 2 +- llama_stack/templates/template.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llama_stack/scripts/distro_codegen.py b/llama_stack/scripts/distro_codegen.py index b82319bd5..84bf9af2a 100644 --- a/llama_stack/scripts/distro_codegen.py +++ b/llama_stack/scripts/distro_codegen.py @@ -103,7 +103,7 @@ def generate_dependencies_file(): deps_file = REPO_ROOT / "distributions" / "dependencies.json" with open(deps_file, "w") as f: - json.dump(distribution_deps, f, indent=2) + f.write(json.dumps(distribution_deps, indent=2) + "\n") def main(): diff --git a/llama_stack/templates/template.py b/llama_stack/templates/template.py index fd37016f8..fe0278718 100644 --- a/llama_stack/templates/template.py +++ b/llama_stack/templates/template.py @@ -161,4 +161,4 @@ class DistributionTemplate(BaseModel): docs = self.generate_markdown_docs() with open(doc_output_dir / f"{self.name}.md", "w") as f: - f.write(docs) + f.write(docs if docs.endswith("\n") else docs + "\n")