Skip to content

Commit fb825b0

Browse files
jemeza-codegencodegen-bot
and
codegen-bot
authored
Doc Visualization Updates (#185)
# Motivation - Links embedded visualizations to the code they visualize and the codemod that generated them # Content changes to docs/introduction/overview.mdx and docs/tutorials/codebase-visualization.mdx # Testing tested by running locally # Please check the following before marking your PR as ready for review - [x] I have added tests for my changes - [x] I have updated the documentation or added new documentation as needed - [x] I have read and agree to the [Contributor License Agreement](../CLA.md) --------- Co-authored-by: codegen-bot <[email protected]>
1 parent 8c818dd commit fb825b0

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

docs/introduction/overview.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,21 @@ pip install codegen
6969

7070
Codegen enables you to programmatically manipulate code with scale and precision.
7171

72-
<Frame caption="Call graph visualization for modal/modal-client">
72+
<Frame caption="Call graph visualization for modal/modal-client/_Client">
7373
<iframe
7474
width="100%"
7575
height="500px"
7676
scrolling="no"
77-
src={`https://codegen.sh/embedded/graph?id=299beefe-0207-43b6-bff3-6ca9036f62eb&zoom=0.5`}
77+
src={`https://codegen.sh/embedded/graph?id=66e2e195-ceec-4935-876a-ed4cfc1731c7&zoom=0.5&targetNodeName=_Client`}
7878
className="rounded-xl"
7979
style={{
8080
backgroundColor: "#15141b",
8181
}}
8282
></iframe>
8383
</Frame>
84+
<Info>
85+
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)
86+
</Info>
8487

8588
Common use cases include:
8689

docs/tutorials/codebase-visualization.mdx

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ iconType: "solid"
1111
width="100%"
1212
height="600px"
1313
scrolling="no"
14+
loading="lazy"
1415
src={`https://codegen.sh/embedded/graph?id=347d349e-263b-481a-9601-1cd205b332b9&zoom=1&targetNodeName=export_asset`}
1516
className="rounded-xl "
1617
style={{
@@ -150,25 +151,30 @@ create_downstream_call_trace(target_method)
150151
codebase.visualize(G)
151152
```
152153

153-
### Common Use Cases
154-
The call graph visualization is particularly useful for:
155-
- Understanding complex codebases
156-
- Planning refactoring efforts
157-
- Identifying tightly coupled components
158-
- Analyzing critical paths
159-
- Documenting system architecture
160154

161155
### Take a look
162156
<iframe
163157
width="100%"
164158
height="600px"
165159
scrolling="no"
166-
src={`https://codegen.sh/embedded/graph?id=9a141c52-c0c2-4737-bdc3-5d164791d3b5&zoom=1&targetNodeName=SharingConfigurationViewSet.patch`}
160+
loading="lazy"
161+
src={`https://codegen.sh/embedded/graph?id=6a34b45d-c8ad-422e-95a8-46d4dc3ce2b0&zoom=1&targetNodeName=SharingConfigurationViewSet.patch`}
167162
className="rounded-xl "
168163
style={{
169164
backgroundColor: "#15141b",
170165
}}
171166
></iframe>
167+
<Info>
168+
View on [codegen.sh](https://www.codegen.sh/codemod/6a34b45d-c8ad-422e-95a8-46d4dc3ce2b0/public/diff)
169+
</Info>
170+
171+
### Common Use Cases
172+
The call graph visualization is particularly useful for:
173+
- Understanding complex codebases
174+
- Planning refactoring efforts
175+
- Identifying tightly coupled components
176+
- Analyzing critical paths
177+
- Documenting system architecture
172178

173179
## Function Dependency Graph
174180

@@ -240,12 +246,16 @@ codebase.visualize(G)
240246
width="100%"
241247
height="600px"
242248
scrolling="no"
243-
src={`https://codegen.sh/embedded/graph?id=bb7b227b-cc89-4e92-b71f-fb0d6265eb3d&zoom=0.8&targetNodeName=get_query_runner`}
249+
loading="lazy"
250+
src={`https://codegen.sh/embedded/graph?id=39a36f0c-9d35-4666-9db7-12ae7c28fc17&zoom=0.8&targetNodeName=get_query_runner`}
244251
className="rounded-xl "
245252
style={{
246253
backgroundColor: "#15141b",
247254
}}
248255
></iframe>
256+
<Info>
257+
View on [codegen.sh](https://www.codegen.sh/codemod/39a36f0c-9d35-4666-9db7-12ae7c28fc17/public/diff)
258+
</Info>
249259

250260
## Blast Radius visualization
251261

@@ -337,21 +347,26 @@ G.add_node(target_func, color=COLOR_PALETTE.get("StartFunction"))
337347
# Build the visualization
338348
create_blast_radius_visualization(target_func)
339349

340-
# Render reversed graph to show impact flow
341-
codebase.visualize(G.reverse())
350+
# Render graph to show impact flow
351+
# Note: a -> b means changes to a will impact b
352+
codebase.visualize(G)
342353
```
343354

344355
### Take a look
345356
<iframe
346357
width="100%"
347358
height="600px"
348359
scrolling="no"
349-
src={`https://codegen.sh/embedded/graph?id=347d349e-263b-481a-9601-1cd205b332b9&zoom=1&targetNodeName=export_asset`}
360+
loading="lazy"
361+
src={`https://codegen.sh/embedded/graph?id=d255db6c-9a86-4197-9b78-16c506858a3b&zoom=1&targetNodeName=export_asset`}
350362
className="rounded-xl "
351363
style={{
352364
backgroundColor: "#15141b",
353365
}}
354366
></iframe>
367+
<Info>
368+
View on [codegen.sh](https://www.codegen.sh/codemod/d255db6c-9a86-4197-9b78-16c506858a3b/public/diff)
369+
</Info>
355370

356371
## What's Next?
357372

src/codegen/cli/commands/create/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def create_command(session: CodegenSession, name: str, path: Path, description:
103103

104104
# Write the function code
105105
codemod_path.write_text(code)
106-
107106

108107
except (ServerError, ValueError) as e:
109108
raise click.ClickException(str(e))

0 commit comments

Comments
 (0)