Skip to content

Commit e808eca

Browse files
authored
feat: from codegen import Codebase (#55)
# 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 - [ ] I have read and agree to the [Contributor License Agreement](../CLA.md)
1 parent 17ce6c4 commit e808eca

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Codegen
22

33
[![Documentation](https://img.shields.io/badge/docs-docs.codegen.com-blue)](https://docs.codegen.com)
4-
[![Unit Tests](https://github.com/codegen-sh/codegen-sdk/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/codegen-sh/codegen-sdk/actions/workflows/unit-tests.yml)
54

65
[Codegen](https://docs.codegen.com) is a python library for manipulating codebases.
76

@@ -42,7 +41,7 @@ We built Codegen backwards from real-world refactors performed on enterprise cod
4241

4342
- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management.
4443

45-
- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code. Built and validated on refactors at companies like [Ramp](https://ramp.com).
44+
- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code.
4645

4746
- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself.
4847

src/codegen/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from codegen.cli.sdk.decorator import function
2+
from codegen.cli.sdk.functions import Function
3+
from codegen.sdk.core.codebase import Codebase
4+
5+
__all__ = ["Codebase", "Function", "function"]

tests/unit/test_imports.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import codegen
2+
from codegen import Codebase
3+
4+
5+
def test_codegen_imports():
6+
# Test decorated function
7+
@codegen.function(name="sample_codemod")
8+
def run(codebase):
9+
pass
10+
11+
# Test class
12+
cls = codegen.Function
13+
assert cls is not None
14+
15+
codebase = Codebase("./")
16+
assert codebase is not None

0 commit comments

Comments
 (0)