Skip to content

Commit 27beaec

Browse files
authored
refactor!: Move codegen.sdk to graph_sitter (#12)
- Moves codegen.sdk to graph_sitter, codegen.shared to graph_sitter.shared - Updates various build/dev tools to use correct package names
1 parent ac6c44a commit 27beaec

File tree

943 files changed

+6039
-6629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

943 files changed

+6039
-6629
lines changed

.github/codecov.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
codecov:
22
branch: develop
3-
max_report_age: '12h'
3+
max_report_age: "12h"
44
component_management:
5-
default_rules: # default rules that will be inherited by all components
5+
default_rules: # default rules that will be inherited by all components
66
statuses:
77
- type: project # in this case every component that doens't have a status defined will have a project type one
88
threshold: 0 # Shouldn't remove coverage
99
individual_components:
10-
- component_id: codegen-sdk-python # this is an identifier that should not be changed
11-
name: codegen-sdk-python # this is a display name, and can be changed freely
10+
- component_id: graph-sitter-python # this is an identifier that should not be changed
11+
name: graph-sitter-python # this is a display name, and can be changed freely
1212
paths:
13-
- src/codegen/sdk/python/**
13+
- src/graph_sitter/python/**
1414
statuses:
1515
- type: project # in this case every component that doens't have a status defined will have a project type one
1616
threshold: 0 # Shouldn't remove coverage
1717
- type: patch
1818
target: 50 # Language specific featues must be 100% covered
1919
flags:
2020
- unit-tests
21-
- component_id: codegen-sdk-typescript
22-
name: codegen-sdk-typescript
21+
- component_id: graph-sitter-typescript
22+
name: graph-sitter-typescript
2323
paths:
24-
- src/codegen/sdk/typescript/**
24+
- src/graph_sitter/typescript/**
2525
statuses:
2626
- type: project # in this case every component that doens't have a status defined will have a project type one
2727
threshold: 0 # Shouldn't remove coverage
2828
- type: patch
2929
target: 50 # Language specific featues must be 100% covered
3030
flags:
3131
- unit-tests
32-
- component_id: codegen-sdk-core
33-
name: codegen-sdk-core
32+
- component_id: graph-sitter-core
33+
name: graph-sitter-core
3434
paths:
35-
- src/codegen/sdk/**
35+
- src/graph_sitter/**
3636
flags:
3737
- unit-tests
3838

3939
flag_management:
4040
default_rules:
4141
carryforward: true
42-
carryforward_mode: 'labels'
42+
carryforward_mode: "labels"
4343
statuses:
4444
- type: project
4545
individual_flags:
4646
- name: unit-tests
4747
carryforward: true
48-
carryforward_mode: 'labels'
48+
carryforward_mode: "labels"
4949
statuses:
50-
- type: 'project'
51-
- type: 'patch'
50+
- type: "project"
51+
- type: "patch"
5252
- name: codemod-tests
5353
carryforward: true
54-
carryforward_mode: 'labels'
54+
carryforward_mode: "labels"
5555
- name: integration-tests
5656
carryforward: true
57-
carryforward_mode: 'labels'
57+
carryforward_mode: "labels"
5858
comment:
5959
layout: "condensed_header, condensed_files"
6060
hide_project_coverage: true
6161
cli:
6262
plugins:
6363
pycoverage:
64-
report_type: 'json'
64+
report_type: "json"
6565
include_contexts: true
6666
runners:
6767
pytest:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ alembic_versions_backup
5656
**/.virtual_documents
5757
/.nvmrc
5858
**/build/test-results/test/TEST*.xml
59-
src/codegen/sdk/__init__.py
59+
src/graph_sitter/__init__.py
6060
src/**/*.html
6161
.ccache/
6262
uv-*.tar.gz

codegen-examples/examples/ai_impact_analysis/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from codegen.extensions.attribution.cli import run
77
from codegen.git.repo_operator.repo_operator import RepoOperator
88
from codegen.git.schemas.repo_config import RepoConfig
9-
from codegen.sdk.codebase.config import ProjectConfig
10-
from codegen.shared.enums.programming_language import ProgrammingLanguage
9+
from graph_sitter.codebase.config import ProjectConfig
10+
from graph_sitter.shared.enums.programming_language import ProgrammingLanguage
1111

1212
if __name__ == "__main__":
1313
try:

codegen-examples/examples/cyclomatic_complexity/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.core.statements.for_loop_statement import ForLoopStatement
4-
from codegen.sdk.core.statements.if_block_statement import IfBlockStatement
5-
from codegen.sdk.core.statements.try_catch_statement import TryCatchStatement
6-
from codegen.sdk.core.statements.while_statement import WhileStatement
3+
from graph_sitter.core.statements.for_loop_statement import ForLoopStatement
4+
from graph_sitter.core.statements.if_block_statement import IfBlockStatement
5+
from graph_sitter.core.statements.try_catch_statement import TryCatchStatement
6+
from graph_sitter.core.statements.while_statement import WhileStatement
77

88

99
@codegen.function("cyclomatic-complexity")

codegen-examples/examples/document_functions/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.core.external_module import ExternalModule
4-
from codegen.sdk.core.import_resolution import Import
5-
from codegen.sdk.core.symbol import Symbol
3+
from graph_sitter.core.external_module import ExternalModule
4+
from graph_sitter.core.import_resolution import Import
5+
from graph_sitter.core.symbol import Symbol
66

77

88
def hop_through_imports(imp: Import) -> Symbol | ExternalModule:

codegen-examples/examples/generate_training_data/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import codegen
44
from codegen import Codebase
5-
from codegen.sdk.core.external_module import ExternalModule
6-
from codegen.sdk.core.import_resolution import Import
7-
from codegen.sdk.core.symbol import Symbol
5+
from graph_sitter.core.external_module import ExternalModule
6+
from graph_sitter.core.import_resolution import Import
7+
from graph_sitter.core.symbol import Symbol
88

99

1010
def hop_through_imports(imp: Import) -> Symbol | ExternalModule:

codegen-examples/examples/promises_to_async_await/convert_promises_twilio_repository.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"outputs": [],
2222
"source": [
2323
"from codegen import Codebase\n",
24-
"from codegen.sdk.enums import ProgrammingLanguage\n",
25-
"from codegen.sdk.core.statements.statement import StatementType"
24+
"from graph_sitter.enums import ProgrammingLanguage\n",
25+
"from graph_sitter.core.statements.statement import StatementType"
2626
]
2727
},
2828
{

codegen-examples/examples/promises_to_async_await/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.core.statements.statement import StatementType
3+
from graph_sitter.core.statements.statement import StatementType
44

55

66
@codegen.function("promises-to-async-await")

codegen-examples/examples/reexport_management/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.typescript.file import TSImport
3+
from graph_sitter.typescript.file import TSImport
44

55
processed_imports = set()
66

codegen-examples/examples/remove_default_exports/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.typescript.file import TSFile
3+
from graph_sitter.typescript.file import TSFile
44

55

66
@codegen.function("remove-default-exports")

codegen-examples/examples/repo_analytics/run.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from typing import Dict, Any
22
from codegen import Codebase
3-
from codegen.sdk.core.statements.for_loop_statement import ForLoopStatement
4-
from codegen.sdk.core.statements.if_block_statement import IfBlockStatement
5-
from codegen.sdk.core.statements.try_catch_statement import TryCatchStatement
6-
from codegen.sdk.core.statements.while_statement import WhileStatement
7-
from codegen.sdk.core.expressions.binary_expression import BinaryExpression
8-
from codegen.sdk.core.expressions.unary_expression import UnaryExpression
9-
from codegen.sdk.core.expressions.comparison_expression import ComparisonExpression
3+
from graph_sitter.core.statements.for_loop_statement import ForLoopStatement
4+
from graph_sitter.core.statements.if_block_statement import IfBlockStatement
5+
from graph_sitter.core.statements.try_catch_statement import TryCatchStatement
6+
from graph_sitter.core.statements.while_statement import WhileStatement
7+
from graph_sitter.core.expressions.binary_expression import BinaryExpression
8+
from graph_sitter.core.expressions.unary_expression import UnaryExpression
9+
from graph_sitter.core.expressions.comparison_expression import ComparisonExpression
1010
import math
1111
import re
1212
import requests

codegen-examples/examples/sqlalchemy_1.6_to_2.0/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
4-
from codegen.sdk.core.expressions.chained_attribute import ChainedAttribute
3+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
4+
from graph_sitter.core.expressions.chained_attribute import ChainedAttribute
55

66

77
@codegen.function("sqlalchemy-1.4-to-2.0")

codegen-examples/examples/sqlalchemy_soft_delete/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44

55
import codegen
6-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
6+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
77

88

99
def should_process_join_call(call, soft_delete_models, join_methods):
@@ -91,7 +91,7 @@ def process_soft_deletes(codebase):
9191

9292
if __name__ == "__main__":
9393
from codegen import Codebase
94-
from codegen.configs.models.codebase import CodebaseConfig
94+
from graph_sitter.configs.models.codebase import CodebaseConfig
9595

9696
repo_path = Path("/tmp/core")
9797
repo_url = "https://github.com/hasgeek/funnel.git"

codegen-examples/examples/sqlalchemy_type_annotations/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import codegen
66
from codegen import Codebase
7-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
7+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
88

99

1010
def init_git_repo(repo_path: str) -> None:

codegen-examples/examples/swebench_agent_run/local_run.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"metadata": {},
4242
"outputs": [],
4343
"source": [
44-
"from codegen.sdk.core.codebase import Codebase # noqa: E402\n",
44+
"from graph_sitter.core.codebase import Codebase # noqa: E402\n",
4545
"\n",
4646
"codebase = Codebase.from_repo(repo_full_name=\"codegen-sh/cloud\")"
4747
]

codegen-examples/examples/swebench_agent_run/run_eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from codegen.extensions.swebench.harness import run_agent_on_entry
1212
from codegen.extensions.swebench.utils import SweBenchExample, get_swe_bench_examples
1313
from codegen.extensions.swebench.report import generate_report
14-
from codegen.sdk.core.codebase import Codebase
14+
from graph_sitter.core.codebase import Codebase
1515

1616
PREDS_DNAME = Path(__file__).parent / "predictions"
1717
LOG_DIR = Path(__file__).parent / "logs"

codegen-examples/examples/symbol-attributions/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from codegen.extensions.attribution.main import add_attribution_to_symbols
77
from codegen.git.repo_operator.repo_operator import RepoOperator
88
from codegen.git.schemas.repo_config import RepoConfig
9-
from codegen.sdk.codebase.config import ProjectConfig
10-
from codegen.shared.enums.programming_language import ProgrammingLanguage
9+
from graph_sitter.codebase.config import ProjectConfig
10+
from graph_sitter.shared.enums.programming_language import ProgrammingLanguage
1111

1212

1313
def print_symbol_attribution(codebase):

codegen-examples/examples/usesuspensequery_to_usesuspensequeries/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import codegen
22
from codegen import Codebase
3-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
3+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
44

55

66
@codegen.function("useSuspenseQuery-to-useSuspenseQueries")

codegen-examples/examples/visualize_codebases/blast_radius.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import codegen
22
import networkx as nx
33
from codegen import Codebase
4-
from codegen.sdk.core.dataclasses.usage import Usage
5-
from codegen.sdk.python.function import PyFunction
6-
from codegen.sdk.python.symbol import PySymbol
4+
from graph_sitter.core.dataclasses.usage import Usage
5+
from graph_sitter.python.function import PyFunction
6+
from graph_sitter.python.symbol import PySymbol
77

88
# Create a directed graph for visualizing relationships between code elements
99
G = nx.DiGraph()

codegen-examples/examples/visualize_codebases/call_trace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import codegen
22
import networkx as nx
33
from codegen import Codebase
4-
from codegen.sdk.core.class_definition import Class
5-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
6-
from codegen.sdk.core.external_module import ExternalModule
7-
from codegen.sdk.core.function import Function
4+
from graph_sitter.core.class_definition import Class
5+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
6+
from graph_sitter.core.external_module import ExternalModule
7+
from graph_sitter.core.function import Function
88

99
G = nx.DiGraph()
1010

codegen-examples/examples/visualize_codebases/dependency_trace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import codegen
22
import networkx as nx
33
from codegen import Codebase
4-
from codegen.sdk.core.class_definition import Class
5-
from codegen.sdk.core.import_resolution import Import
6-
from codegen.sdk.core.symbol import Symbol
4+
from graph_sitter.core.class_definition import Class
5+
from graph_sitter.core.import_resolution import Import
6+
from graph_sitter.core.symbol import Symbol
77

88
G = nx.DiGraph()
99

codegen-examples/examples/visualize_codebases/method_relationships.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import codegen
22
import networkx as nx
33
from codegen import Codebase
4-
from codegen.sdk.core.class_definition import Class
5-
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
6-
from codegen.sdk.core.external_module import ExternalModule
7-
from codegen.sdk.core.function import Function
4+
from graph_sitter.core.class_definition import Class
5+
from graph_sitter.core.detached_symbols.function_call import FunctionCall
6+
from graph_sitter.core.external_module import ExternalModule
7+
from graph_sitter.core.function import Function
88

99
G = nx.DiGraph()
1010

docs/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from sybil.parsers.markdown import PythonCodeBlockParser
77
from doctest import ELLIPSIS
88

9-
from codegen.sdk.code_generation.current_code_codebase import get_documented_objects
10-
from codegen.sdk.codebase.factory.get_session import get_codebase_session
11-
from codegen.shared.enums.programming_language import ProgrammingLanguage
12-
from codegen.sdk.typescript.class_definition import TSClass
13-
from codegen.sdk.typescript.file import TSFile
9+
from graph_sitter.code_generation.current_code_codebase import get_documented_objects
10+
from graph_sitter.codebase.factory.get_session import get_codebase_session
11+
from graph_sitter.shared.enums.programming_language import ProgrammingLanguage
12+
from graph_sitter.typescript.class_definition import TSClass
13+
from graph_sitter.typescript.file import TSFile
1414
from codegen.gscli.generate.runner_imports import EXTERNAL_IMPORTS
1515

1616
SAMPLE_FILENAME = {

hatch.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build.hooks.vcs]
22
dependencies = ["hatch-vcs>=0.4.0"]
3-
version-file = "src/codegen/sdk/__init__.py"
3+
version-file = "src/graph_sitter/__init__.py"
44

55
[metadata]
66
allow-direct-references = true
@@ -30,7 +30,7 @@ dependencies = [
3030
]
3131

3232
[build.targets.wheel.hooks.cython.options]
33-
src = "codegen/sdk"
33+
src = "graph_sitter"
3434
compile_args = [
3535
"-O3",
3636
{ platforms = [
@@ -77,7 +77,7 @@ exclude = [
7777
macos-max-compat = false
7878

7979
[build]
80-
packages = ["src/codegen"]
80+
packages = ["src/graph_sitter", "src/codegen"]
8181

8282
[metadata.hooks.vcs.urls]
8383
Homepage = "https://www.codegen.com/"

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "codegen"
2+
name = "graph-sitter"
33
dynamic = ["version", "urls"]
44
description = "Scriptable interface to a powerful, multi-lingual language server built on top of Tree-sitter"
55
readme = "README.md"
@@ -230,6 +230,7 @@ build-backend = "hatchling.build"
230230
[tool.deptry]
231231
extend_exclude = [".*/eval/test_files/.*.py", ".*conftest.py"]
232232
pep621_dev_dependency_groups = ["types"]
233+
known_first_party = ["graph_sitter"]
233234
[tool.deptry.per_rule_ignores]
234235
DEP002 = [
235236
"pyright",

0 commit comments

Comments
 (0)