From 5fc55843ef4b3a2eed7a8f85c6795b5def98bc41 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Wed, 29 Jan 2025 11:39:31 -0800 Subject: [PATCH 1/3] updated codebase visualizations to link to codemods --- docs/introduction/overview.mdx | 7 +++-- docs/tutorials/codebase-visualization.mdx | 35 +++++++++++++++-------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/docs/introduction/overview.mdx b/docs/introduction/overview.mdx index 99f93c681..8a84cd868 100644 --- a/docs/introduction/overview.mdx +++ b/docs/introduction/overview.mdx @@ -69,18 +69,21 @@ pip install codegen Codegen enables you to programmatically manipulate code with scale and precision. - + + +View source code on [modal/modal-client](https://github.com/modal-labs/modal-client/blob/cbac0d80dfd98588027ecd21850152776be3ab82/modal/client.py#L70). View codemod on [codegen.sh](https://www.codegen.sh/codemod/66e2e195-ceec-4935-876a-ed4cfc1731c7/public/diff) + Common use cases include: diff --git a/docs/tutorials/codebase-visualization.mdx b/docs/tutorials/codebase-visualization.mdx index e94752e43..4f0499466 100644 --- a/docs/tutorials/codebase-visualization.mdx +++ b/docs/tutorials/codebase-visualization.mdx @@ -150,25 +150,29 @@ create_downstream_call_trace(target_method) codebase.visualize(G) ``` -### Common Use Cases -The call graph visualization is particularly useful for: - - Understanding complex codebases - - Planning refactoring efforts - - Identifying tightly coupled components - - Analyzing critical paths - - Documenting system architecture ### Take a look + +View on [codegen.sh](https://www.codegen.sh/codemod/6a34b45d-c8ad-422e-95a8-46d4dc3ce2b0/public/diff) + + +### Common Use Cases +The call graph visualization is particularly useful for: + - Understanding complex codebases + - Planning refactoring efforts + - Identifying tightly coupled components + - Analyzing critical paths + - Documenting system architecture ## Function Dependency Graph @@ -240,12 +244,15 @@ codebase.visualize(G) width="100%" height="600px" scrolling="no" - src={`https://codegen.sh/embedded/graph?id=bb7b227b-cc89-4e92-b71f-fb0d6265eb3d&zoom=0.8&targetNodeName=get_query_runner`} + src={`https://codegen.sh/embedded/graph?id=39a36f0c-9d35-4666-9db7-12ae7c28fc17&zoom=0.8&targetNodeName=get_query_runner`} className="rounded-xl " style={{ backgroundColor: "#15141b", }} > + +View on [codegen.sh](https://www.codegen.sh/codemod/39a36f0c-9d35-4666-9db7-12ae7c28fc17/public/diff) + ## Blast Radius visualization @@ -337,8 +344,9 @@ G.add_node(target_func, color=COLOR_PALETTE.get("StartFunction")) # Build the visualization create_blast_radius_visualization(target_func) -# Render reversed graph to show impact flow -codebase.visualize(G.reverse()) +# Render graph to show impact flow +# Note: a -> b means changes to a will impact b +codebase.visualize(G) ``` ### Take a look @@ -346,12 +354,15 @@ codebase.visualize(G.reverse()) width="100%" height="600px" scrolling="no" - src={`https://codegen.sh/embedded/graph?id=347d349e-263b-481a-9601-1cd205b332b9&zoom=1&targetNodeName=export_asset`} + src={`https://codegen.sh/embedded/graph?id=d255db6c-9a86-4197-9b78-16c506858a3b&zoom=1&targetNodeName=export_asset`} className="rounded-xl " style={{ backgroundColor: "#15141b", }} > + +View on [codegen.sh](https://www.codegen.sh/codemod/d255db6c-9a86-4197-9b78-16c506858a3b/public/diff) + ## What's Next? From 859553a6d0f4d520462b3fe9575a7d24f75766e6 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Wed, 29 Jan 2025 14:52:42 -0800 Subject: [PATCH 2/3] adding lazy loading to embedded graph visualizations --- docs/tutorials/codebase-visualization.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/tutorials/codebase-visualization.mdx b/docs/tutorials/codebase-visualization.mdx index 4f0499466..a8d29484a 100644 --- a/docs/tutorials/codebase-visualization.mdx +++ b/docs/tutorials/codebase-visualization.mdx @@ -11,6 +11,7 @@ iconType: "solid" width="100%" height="600px" scrolling="no" + loading="lazy" src={`https://codegen.sh/embedded/graph?id=347d349e-263b-481a-9601-1cd205b332b9&zoom=1&targetNodeName=export_asset`} className="rounded-xl " style={{ @@ -156,6 +157,7 @@ codebase.visualize(G) width="100%" height="600px" scrolling="no" + loading="lazy" src={`https://codegen.sh/embedded/graph?id=6a34b45d-c8ad-422e-95a8-46d4dc3ce2b0&zoom=1&targetNodeName=SharingConfigurationViewSet.patch`} className="rounded-xl " style={{ @@ -244,6 +246,7 @@ codebase.visualize(G) width="100%" height="600px" scrolling="no" + loading="lazy" src={`https://codegen.sh/embedded/graph?id=39a36f0c-9d35-4666-9db7-12ae7c28fc17&zoom=0.8&targetNodeName=get_query_runner`} className="rounded-xl " style={{ @@ -354,6 +357,7 @@ codebase.visualize(G) width="100%" height="600px" scrolling="no" + loading="lazy" src={`https://codegen.sh/embedded/graph?id=d255db6c-9a86-4197-9b78-16c506858a3b&zoom=1&targetNodeName=export_asset`} className="rounded-xl " style={{ From 63002b712475a7fe87cf672f8ba34e900ecb7c9b Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Wed, 29 Jan 2025 15:21:04 -0800 Subject: [PATCH 3/3] precommit fix --- src/codegen/cli/commands/create/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codegen/cli/commands/create/main.py b/src/codegen/cli/commands/create/main.py index 0a7b8f9ce..6a95bdb59 100644 --- a/src/codegen/cli/commands/create/main.py +++ b/src/codegen/cli/commands/create/main.py @@ -103,7 +103,6 @@ def create_command(session: CodegenSession, name: str, path: Path, description: # Write the function code codemod_path.write_text(code) - except (ServerError, ValueError) as e: raise click.ClickException(str(e))