Skip to content

Prettify docs #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/building-with-codegen/codebase-visualization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,3 @@ def create_custom_graph(codebase):
- Some graph layouts may take time to compute
- Preview features only work when adding symbol objects directly

Remember to:

1. Use symbol objects (not just names) when you want rich previews
2. Focus visualizations on specific aspects of the codebase
3. Use NetworkX's built-in graph types (DiGraph, Graph)
4. Keep graphs manageable in size for better readability
2 changes: 0 additions & 2 deletions docs/building-with-codegen/dependencies-and-usages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ iconType: "solid"

Codegen pre-computes dependencies and usages for all symbols in the codebase, enabling constant-time queries for these relationships.

This document explains how to use the dependency and usage tracking APIs in Codegen.

## Overview

Codegen provides two main ways to track relationships between symbols:
Expand Down
1 change: 0 additions & 1 deletion docs/building-with-codegen/files-and-directories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Codegen provides three primary abstractions for working with your codebase's fil
[SourceFile](/api-reference/core/SourceFile) is a subclass of [File](/api-reference/core/File) that provides additional functionality for source code files.
</Info>

This guide explains how to effectively use these classes to manage your codebase.

## Accessing Files and Directories

Expand Down
1 change: 0 additions & 1 deletion docs/building-with-codegen/inheritable-behaviors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ iconType: "solid"

Codegen uses a set of core behaviors that can be inherited by code elements. These behaviors provide consistent APIs across different types of symbols.

This guide explains the key behaviors and how to use them effectively.

## Core Behaviors

Expand Down
7 changes: 0 additions & 7 deletions docs/building-with-codegen/the-editable-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,3 @@ for var in function.code_block.get_local_var_assignments():
print(f"Warning: {var.name} defined in try block")
```

## Best Practices

1. **Use High-Level Operations**: Prefer operations like `rename()` over direct source editing when possible.
2. **Leverage Search**: Use the built-in search capabilities rather than parsing text manually.
3. **Work with Extended Sources**: Use `extended_source` when you need to modify decorators or comments together with the code.
4. **Mind the Context**: Remember that each Editable knows its location and relationships in the code.
5. **Trust the Formatting**: Let Codegen handle whitespace and syntax details automatically.
1 change: 0 additions & 1 deletion docs/building-with-codegen/variable-assignments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Codegen's enables manipulation of variable assignments via the following classes
- [AssignmentStatement](../api-reference/core/AssignmentStatement) - A statement containing one or more assignments
- [Assignment](../api-reference/core/Assignment) - A single assignment within an AssignmentStatement

This document provides examples of how to manipulate assignments using these APIs

### Simple Value Changes

Expand Down
2 changes: 1 addition & 1 deletion docs/introduction/community.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Join the growing Codegen community! We're excited to have you be part of our jou

We welcome contributions of all kinds! Whether you're fixing a typo in documentation, reporting a bug, or implementing a new feature, we appreciate your help in making Codegen better.

Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/main/CONTRIBUTING.md) on GitHub to learn how to:
Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/develop/CONTRIBUTING.md) on GitHub to learn how to:

- Set up your development environment
- Submit pull requests
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/increase-type-coverage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Each of these has an associated setter.

## Finding the extent of your type coverage

T to get an indication of your progress on type coverage, analyze the percentage of typed elements across your codebase
To get an indication of your progress on type coverage, analyze the percentage of typed elements across your codebase

```python
# Initialize counters for parameters
Expand Down
13 changes: 0 additions & 13 deletions docs/tutorials/react-modernization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,3 @@ components/
code](/building-with-codegen/moving-symbols) here.
</Note>

## Best Practices

1. **Test Thoroughly**: React modernization can affect component behavior. Test each conversion carefully.

2. **Incremental Updates**: Convert components gradually, especially in large codebases.

3. **Update Dependencies**: Ensure your package.json has the required dependencies for modern React features.

4. **TypeScript Migration**: Consider using this opportunity to add TypeScript support to your components.

5. **Documentation**: Update component documentation to reflect the new functional patterns.

By following these guidelines, you can effectively modernize your React codebase while maintaining functionality and improving maintainability.
33 changes: 0 additions & 33 deletions docs/tutorials/training-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -200,36 +200,3 @@ def create_training_example(function_data):
examples = [create_training_example(f) for f in training_data["functions"]]
```

## Best Practices

1. **Filter Small Functions**: Skip trivial functions that won't provide meaningful training data:
```python
if len(function.source.split("\n")) < 2:
continue
```

2. **Ensure Sufficient Context**: Only use functions with dependencies or usages:
```python
if len(context["dependencies"]) + len(context["usages"]) > 0:
training_data["functions"].append(context)
```

3. **Track Metadata**: Keep statistics about your training data:
```python
training_data["metadata"] = {
"total_functions": len(codebase.functions),
"total_processed": len(training_data["functions"]),
"avg_dependencies": average_dependencies,
"avg_usages": average_usages
}
```

4. **Handle Import Chains**: Follow import chains to find root implementations:
```python
def hop_through_imports(imp: Import) -> Symbol | ExternalModule:
if isinstance(imp.imported_symbol, Import):
return hop_through_imports(imp.imported_symbol)
return imp.imported_symbol
```

By following these guidelines, you can generate high-quality training data for your LLM projects while maintaining code quality and consistency.