Skip to content

Commit 7916928

Browse files
Eli cg 10431 rename gs to codegensdk (#34)
# 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) --------- Co-authored-by: Edward Li <jiaxi.edwardli@gmail.com>
1 parent b2b5c95 commit 7916928

File tree

754 files changed

+3828
-3867
lines changed

Some content is hidden

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

754 files changed

+3828
-3867
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ executors:
99
default_image:
1010
docker:
1111
- image: ghcr.io/astral-sh/uv:python<<pipeline.parameters.python_version>>-bookworm
12-
working_directory: /graph-sitter
12+
working_directory: /codegen-sdk
1313
environment:
1414
UV_COMPILE_BYTECODE: 1
1515
UV_LINK_MODE: copy

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
* @codegen-sh/graph-sitter @codegen-team
1+
* @codegen-sh/codegen-sdk @codegen-team
22
**/skills @codegen-sh/capabilities @codegen-team @codegen-sh/capabilities
3-
**/code_generation @codegen-sh/graph-sitter @codegen-team
3+
**/code_generation @codegen-sh/codegen-sdk @codegen-team

.github/codecov.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ component_management:
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: 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
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
1212
paths:
13-
- src/graph_sitter/python/**
13+
- src/codegen/sdk/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
19-
- component_id: graph-sitter-typescript
20-
name: graph-sitter-typescript
19+
- component_id: codegen-sdk-typescript
20+
name: codegen-sdk-typescript
2121
paths:
22-
- src/graph_sitter/typescript/**
22+
- src/codegen/sdk/typescript/**
2323
statuses:
2424
- type: project # in this case every component that doens't have a status defined will have a project type one
2525
threshold: 0 # Shouldn't remove coverage
2626
- type: patch
2727
target: 50 # Language specific featues must be 100% covered
28-
- component_id: graph-sitter-core
29-
name: graph-sitter-core
28+
- component_id: codegen-sdk-core
29+
name: codegen-sdk-core
3030
paths:
31-
- src/graph_sitter/**
31+
- src/codegen/sdk/**
3232
- component_id: codegen-git
3333
name: codegen-git
3434
paths:

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,20 @@ alembic_versions_backup
5555
**/.virtual_documents
5656
/.nvmrc
5757
**/build/test-results/test/TEST*.xml
58-
src/graph_sitter/__init__.py
58+
src/codegen/sdk/__init__.py
5959
src/**/*.html
6060
.ccache/
6161
uv-*.tar.gz
6262
.venv
6363
graph-sitter-types/out/**
6464
graph-sitter-types/typings/**
65+
codegen-sdk/out/**
66+
codegen-sdk/typings/**
6567
coverage.json
6668
tests/verified_codemods/codemod_data/repo_commits.json
6769

6870
# =====[ Docs ]=====
6971
# These are auto-generated
7072
docs/api-reference/core/*
7173
docs/api-reference/python/*
72-
docs/api-reference/typescript/*
74+
docs/api-reference/typescript/*

.pre-commit-config.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ repos:
6363
# - tomli
6464
# files: "codegen-backend/docs/.*/.*.mdx"
6565

66-
# - repo: "local"
67-
# hooks:
68-
# - id: clean-diffs
69-
# name: Clean codemod diffs
70-
# entry: bash -c "cd codegen-backend && poetry run cg codemod clean-diffs"
71-
# types: [file]
72-
# language: system
73-
# pass_filenames: false
74-
# files: "codegen-backend/codegen_tests/graph_sitter/codemod/.*/expected_diff.patch"
7566
- repo: https://github.com/fpgmaas/deptry.git
7667
rev: "0.22.0"
7768
hooks:

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
55
ENV GITHUB_WORKSPACE=/workspace
66
LABEL com.circleci.preserve-entrypoint=true
77
# RUN uv tool install keyring --with keyrings.codeartifact
8-
## Change the working directory to the `graph-sitter` directory
8+
## Change the working directory to the `codegen-sdk` directory
99
FROM base_uv AS install-tools
1010
RUN apt-get update && apt-get install -y build-essential curl git
1111
RUN curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
@@ -15,7 +15,7 @@ RUN corepack enable
1515
RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system coverage
1616
RUN --mount=type=cache,target=/root/.cache/uv uv tool install codecov-cli --python 3.10
1717
RUN --mount=type=cache,target=/root/.cache/uv uv tool install pre-commit --with pre-commit-uv
18-
WORKDIR /graph-sitter
18+
WORKDIR /codegen-sdk
1919
ENTRYPOINT [ "uv", "run", "--frozen", "/bin/bash"]
2020
FROM install-tools AS base-image
2121
## Install dependencies
@@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
2424
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
2525
--mount=type=bind,source=hatch.toml,target=hatch.toml \
2626
uv sync --frozen --no-install-workspace --all-extras
27-
ADD . /graph-sitter
27+
ADD . /codegen-sdk
2828
## Sync the project
2929
RUN --mount=type=cache,target=/root/.cache/uv \
3030
uv sync --frozen --all-extras

codegen-git/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ source = "vcs"
2626
raw-options = { root = ".." }
2727

2828
[tool.hatch.metadata.hooks.vcs]
29-
Homepage = "https://github.com/codegen-sh/graph_sitter"
30-
source_archive = "https://github.com/codegen-sh/graph_sitter/archive/{commit_hash}.zip"
29+
Homepage = "https://github.com/codegen-sh/codegen-sdk"
30+
source_archive = "https://github.com/codegen-sh/codegen-sdk/archive/{commit_hash}.zip"
3131

3232
#[tool.hatch.build.targets.wheel.hooks.mypyc]
3333
#dependencies = ["hatch-mypyc", "pydantic"]

conftest.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import logging
22
import os
33

4-
from graph_sitter.core import autocommit
5-
from graph_sitter.testing.models import Size
4+
from codegen.sdk.testing.models import Size
65

76

87
def find_dirs_to_ignore(start_dir, prefix):
@@ -15,11 +14,6 @@ def find_dirs_to_ignore(start_dir, prefix):
1514
return dirs_to_ignore
1615

1716

18-
collect_ignore_glob = ["codegen_tests/graph_sitter/codemod/**/*.py"]
19-
if not autocommit.enabled:
20-
collect_ignore_glob.append("**/test_autocommit.py")
21-
22-
2317
def pytest_addoption(parser):
2418
parser.addoption(
2519
"--size",

docs/README.md

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

33
This unites docs from:
4-
- graph-sitter (this repo)
4+
- codegen-sdk (this repo)
55
- codegen-cli
66

77
## Development
@@ -17,4 +17,4 @@ You should then get hot reloading. Also recommend installing the `MDX` extension
1717
## Adding New Pages
1818

1919
- Edit the page as a `.mdx` doc
20-
- Make sure to edit `mint.json` so it appears in the UI
20+
- Make sure to edit `mint.json` so it appears in the UI

docs/building-with-codegen/traversing-the-call-graph.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,48 @@ Here's how to build a directed graph of function calls using NetworkX:
3434

3535
```python
3636
import networkx as nx
37-
from graph_sitter.core.interfaces.callable import FunctionCallDefinition
38-
from graph_sitter.core.function import Function
37+
from codegen.sdk.core.interfaces.callable import FunctionCallDefinition
38+
from codegen.sdk.core.function import Function
3939

4040
def create_call_graph(start_func, end_func, max_depth=5):
4141
G = nx.DiGraph()
42-
42+
4343
def traverse_calls(parent_func, current_depth):
4444
if current_depth > max_depth:
4545
return
46-
46+
4747
# Determine source node
4848
if isinstance(parent_func, Function):
4949
src_call = src_func = parent_func
5050
else:
5151
src_func = parent_func.callables[0]
5252
src_call = parent_func.call
53-
53+
5454
# Traverse all function calls
5555
for func_call_def in src_func.call_graph_successors():
5656
call = func_call_def.call
5757
func = func_call_def.callables[0]
58-
58+
5959
# Skip recursive calls
6060
if func.name == src_func.name:
6161
continue
62-
62+
6363
# Add nodes and edges
6464
G.add_node(call)
6565
G.add_edge(src_call, call)
66-
66+
6767
# Check if we reached the target
6868
if func == end_func:
6969
G.add_edge(call, end_func)
7070
return
71-
71+
7272
# Continue traversal
7373
traverse_calls(func_call_def, current_depth + 1)
74-
74+
7575
# Initialize graph
7676
G.add_node(start_func, color="blue") # Start node
7777
G.add_node(end_func, color="red") # End node
78-
78+
7979
# Start traversal
8080
traverse_calls(start_func, 1)
8181
return G
@@ -139,15 +139,15 @@ Find the longest call chain in your codebase:
139139
```python
140140
def get_max_call_chain(function):
141141
G = nx.DiGraph()
142-
142+
143143
def build_graph(func, depth=0):
144144
if depth > 10: # Prevent infinite recursion
145145
return
146146
for successor in func.call_graph_successors():
147147
called_func = successor.callables[0]
148148
G.add_edge(func, called_func)
149149
build_graph(called_func, depth + 1)
150-
150+
151151
build_graph(function)
152152
return nx.dag_longest_path(G)
153153
```

0 commit comments

Comments
 (0)