You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Motivation
<!-- Why is this change necessary? -->
# Content
<!-- Please include a summary of the change -->
# Testing
<!-- How was the change tested? -->
# Please check the following before marking your PR as ready for review
- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed
Copy file name to clipboardExpand all lines: docs/blog/fixing-import-loops.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ Not all import cycles are problematic! Some cycles using dynamic imports can wor
110
110
111
111
PyTorch prevents most circular import issues through dynamic imports which can be seen through the `import_symbol.is_dynamic` property. If any edge in a strongly connected component is dynamic, runtime conflicts are typically resolved.
112
112
113
-
However, we discovered an import loop worth investigating between [`flex_decoding.py`](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/kernel/flex_decoding.py) and [`flex_attention.py`](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/kernel/flex_attention.py):
113
+
However, we discovered an import loop worth investigating between [flex_decoding.py](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/kernel/flex_decoding.py) and [flex_attention.py](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/kernel/flex_attention.py):
Copy file name to clipboardExpand all lines: docs/building-with-codegen/dependencies-and-usages.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,8 @@ Codegen pre-computes dependencies and usages for all symbols in the codebase, en
11
11
12
12
Codegen provides two main ways to track relationships between symbols:
13
13
14
-
-[`.dependencies`](/api-reference/core/Symbol#dependencies) / [`.get_dependencies(...)`](/api-reference/core/Symbol#get-dependencies) - What symbols does this symbol depend on?
15
-
-[`.usages`](/api-reference/core/Symbol#usages) / [`.usages(...)`](/api-reference/core/Symbol#usages) - Where is this symbol used?
14
+
-[.dependencies](/api-reference/core/Symbol#dependencies) / [.get_dependencies(...)](/api-reference/core/Symbol#get-dependencies) - What symbols does this symbol depend on?
15
+
-[.usages](/api-reference/core/Symbol#usages) / [.usages(...)](/api-reference/core/Symbol#usages) - Where is this symbol used?
16
16
17
17
Dependencies and usages are inverses of each other. For example, given the following input code:
You can frequently do bulk modifictions via the [`.edit(...)`](/api-reference/core/Editable#edit) method or [`.replace(...)`](/api-reference/core/File#replace) method.
233
+
You can frequently do bulk modifictions via the [.edit(...)](/api-reference/core/Editable#edit) method or [.replace(...)](/api-reference/core/File#replace) method.
234
234
235
235
<Note>
236
236
Most useful operations will have bespoke APIs that handle edge cases, update
@@ -239,7 +239,7 @@ You can frequently do bulk modifictions via the [`.edit(...)`](/api-reference/co
239
239
240
240
## Moving and Renaming Files
241
241
242
-
Files can be manipulated through methods like [`File.update_filepath()`](/api-reference/core/File#update-filepath), [`File.rename()`](/api-reference/core/File#rename), and [`File.remove()`](/api-reference/core/File#remove):
242
+
Files can be manipulated through methods like [File.update_filepath()](/api-reference/core/File#update-filepath), [File.rename()](/api-reference/core/File#rename), and [File.remove()](/api-reference/core/File#remove):
243
243
244
244
```python
245
245
# Move/rename a file
@@ -263,7 +263,7 @@ for file in codebase.files:
263
263
264
264
## Directories
265
265
266
-
[`Directories`](/api-reference/core/Directory) expose a similar API to the [File](/api-reference/core/File.mdx) class, with the addition of the `subdirectories` property.
266
+
[Directories](/api-reference/core/Directory) expose a similar API to the [File](/api-reference/core/File.mdx) class, with the addition of the `subdirectories` property.
Copy file name to clipboardExpand all lines: docs/building-with-codegen/git-operations.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ sidebarTitle: "Git Operations"
4
4
icon: "code-branch"
5
5
---
6
6
7
-
Many workflows require Git operations. Codegen provides a high-level API for common Git operations through the [`Codebase`](/api-reference/core/Codebase) class, including:
7
+
Many workflows require Git operations. Codegen provides a high-level API for common Git operations through the [Codebase](/api-reference/core/Codebase) class, including:
@@ -91,8 +91,8 @@ for function in codebase.functions:
91
91
92
92
Some features are only available in TypeScript codebases:
93
93
94
-
-**Types and Interfaces**: TypeScript's rich type system ([`TSTypeAlias`](/api-reference/typescript/TSTypeAlias), [`TSInterface`](/api-reference/typescript/TSInterface))
95
-
-**Exports**: Module exports and re-exports ([`TSExport`](/api-reference/typescript/TSExport))
94
+
-**Types and Interfaces**: TypeScript's rich type system ([TSTypeAlias](/api-reference/typescript/TSTypeAlias), [TSInterface](/api-reference/typescript/TSInterface))
95
+
-**Exports**: Module exports and re-exports ([TSExport](/api-reference/typescript/TSExport))
96
96
-**JSX/TSX**: React component handling (see [React and JSX](/building-with-codegen/react-and-jsx))
Copy file name to clipboardExpand all lines: docs/building-with-codegen/moving-symbols.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ iconType: "solid"
7
7
8
8
Codegen provides fast, configurable and safe APIs for moving symbols (functions, classes, variables) between files while automatically handling imports and dependencies.
9
9
10
-
The key API is [`Symbol.move_to_file(...)`](/api-reference/core/Symbol#move-to-file).
10
+
The key API is [Symbol.move_to_file(...)](/api-reference/core/Symbol#move-to-file).
11
11
12
12
## Basic Symbol Movement
13
13
14
-
Simply call [`Symbol.move_to_file(...)`](/api-reference/core/Symbol#move-to-file) to move a symbol to a new file.
14
+
Simply call [Symbol.move_to_file(...)](/api-reference/core/Symbol#move-to-file) to move a symbol to a new file.
15
15
16
16
```python
17
17
# Manipulation code:
@@ -35,7 +35,7 @@ helper_func.move_to_file(file2)
35
35
36
36
## Moving Strategies
37
37
38
-
The [`Symbol.move_to_file(...)`](/api-reference/core/Symbol#move-to-file) method accepts a `strategy` parameter, which can be used to control how imports are updated.
38
+
The [Symbol.move_to_file(...)](/api-reference/core/Symbol#move-to-file) method accepts a `strategy` parameter, which can be used to control how imports are updated.
39
39
40
40
Your options are:
41
41
@@ -51,7 +51,7 @@ Your options are:
51
51
52
52
## Moving Symbols in Bulk
53
53
54
-
Make sure to call [`Codebase.commit(...)`](/api-reference/core/Codebase#commit)_after_ moving symbols in bulk for performant symbol movement.
54
+
Make sure to call [Codebase.commit(...)](/api-reference/core/Codebase#commit)_after_ moving symbols in bulk for performant symbol movement.
0 commit comments