Skip to content

Rename gs to codegen sdk #15

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
default_image:
docker:
- image: ghcr.io/astral-sh/uv:python<<pipeline.parameters.python_version>>-bookworm
working_directory: /graph-sitter
working_directory: /codegen-sdk
environment:
UV_COMPILE_BYTECODE: 1
UV_LINK_MODE: copy
Expand Down
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* @codegen-sh/graph-sitter @codegen-team
* @codegen-sh/codegen-sdk @codegen-team
**/skills @codegen-sh/capabilities @codegen-team @codegen-sh/capabilities
**/code_generation @codegen-sh/graph-sitter @codegen-team
**/code_generation @codegen-sh/codegen-sdk @codegen-team
18 changes: 9 additions & 9 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ component_management:
- type: project # in this case every component that doens't have a status defined will have a project type one
threshold: 0 # Shouldn't remove coverage
individual_components:
- component_id: graph-sitter-python # this is an identifier that should not be changed
name: graph-sitter-python # this is a display name, and can be changed freely
- component_id: codegen-sdk-python # this is an identifier that should not be changed
name: codegen-sdk-python # this is a display name, and can be changed freely
paths:
- src/graph_sitter/python/**
- src/codegen_sdk/python/**
statuses:
- type: project # in this case every component that doens't have a status defined will have a project type one
threshold: 0 # Shouldn't remove coverage
- type: patch
target: 50 # Language specific featues must be 100% covered
- component_id: graph-sitter-typescript
name: graph-sitter-typescript
- component_id: codegen-sdk-typescript
name: codegen-sdk-typescript
paths:
- src/graph_sitter/typescript/**
- src/codegen_sdk/typescript/**
statuses:
- type: project # in this case every component that doens't have a status defined will have a project type one
threshold: 0 # Shouldn't remove coverage
- type: patch
target: 50 # Language specific featues must be 100% covered
- component_id: graph-sitter-core
name: graph-sitter-core
- component_id: codegen-sdk-core
name: codegen-sdk-core
paths:
- src/graph_sitter/**
- src/codegen_sdk/**
- component_id: codegen-git
name: codegen-git
paths:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ alembic_versions_backup
**/.virtual_documents
/.nvmrc
**/build/test-results/test/TEST*.xml
src/graph_sitter/__init__.py
src/codegen_sdk/__init__.py
src/**/*.html
.ccache/
uv-*.tar.gz
.venv
graph-sitter-types/out/**
graph-sitter-types/typings/**
codegen-sdk-types/out/**
codegen-sdk-types/typings/**
coverage.json
tests/verified_codemods/codemod_data/repo_commits.json

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ repos:
# types: [file]
# language: system
# pass_filenames: false
# files: "codegen-backend/codegen_tests/graph_sitter/codemod/.*/expected_diff.patch"
# files: "codegen-backend/codegen_tests/codegen_sdk/codemod/.*/expected_diff.patch"
- repo: https://github.com/fpgmaas/deptry.git
rev: "0.22.0"
hooks:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
ENV GITHUB_WORKSPACE=/workspace
LABEL com.circleci.preserve-entrypoint=true
# RUN uv tool install keyring --with keyrings.codeartifact
## Change the working directory to the `graph-sitter` directory
## Change the working directory to the `codegen-sdk` directory
FROM base_uv AS install-tools
RUN apt-get update && apt-get install -y build-essential curl git
RUN curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
Expand All @@ -15,7 +15,7 @@ RUN corepack enable
RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system coverage
RUN --mount=type=cache,target=/root/.cache/uv uv tool install codecov-cli --python 3.10
RUN --mount=type=cache,target=/root/.cache/uv uv tool install pre-commit --with pre-commit-uv
WORKDIR /graph-sitter
WORKDIR /codegen-sdk
ENTRYPOINT [ "uv", "run", "--frozen", "/bin/bash"]
FROM install-tools AS base-image
## Install dependencies
Expand All @@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=hatch.toml,target=hatch.toml \
uv sync --frozen --no-install-workspace --all-extras
ADD . /graph-sitter
ADD . /codegen-sdk
## Sync the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --all-extras
Expand Down
4 changes: 2 additions & 2 deletions codegen-git/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ source = "vcs"
raw-options = { root = ".." }

[tool.hatch.metadata.hooks.vcs]
Homepage = "https://github.com/codegen-sh/graph_sitter"
source_archive = "https://github.com/codegen-sh/graph_sitter/archive/{commit_hash}.zip"
Homepage = "https://github.com/codegen-sh/codegen_sdk"
source_archive = "https://github.com/codegen-sh/codegen_sdk/archive/{commit_hash}.zip"

#[tool.hatch.build.targets.wheel.hooks.mypyc]
#dependencies = ["hatch-mypyc", "pydantic"]
Expand Down
6 changes: 3 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import os

from graph_sitter.core import autocommit
from graph_sitter.testing.models import Size
from codegen_sdk.core import autocommit
from codegen_sdk.testing.models import Size


def find_dirs_to_ignore(start_dir, prefix):
Expand All @@ -15,7 +15,7 @@ def find_dirs_to_ignore(start_dir, prefix):
return dirs_to_ignore


collect_ignore_glob = ["codegen_tests/graph_sitter/codemod/**/*.py"]
collect_ignore_glob = ["codegen_tests/codegen_sdk/codemod/**/*.py"]
if not autocommit.enabled:
collect_ignore_glob.append("**/test_autocommit.py")

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Codegen Docs

This unites docs from:
- graph-sitter (this repo)
- codegen-sdk (this repo)
- codegen-cli

## Development
Expand Down
4 changes: 2 additions & 2 deletions docs/building-with-codegen/traversing-the-call-graph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Here's how to build a directed graph of function calls using NetworkX:

```python
import networkx as nx
from graph_sitter.core.interfaces.callable import FunctionCallDefinition
from graph_sitter.core.function import Function
from codegen_sdk.core.interfaces.callable import FunctionCallDefinition
from codegen_sdk.core.function import Function

def create_call_graph(start_func, end_func, max_depth=5):
G = nx.DiGraph()
Expand Down
10 changes: 5 additions & 5 deletions docs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from sybil.parsers.markdown import PythonCodeBlockParser
from doctest import ELLIPSIS

from graph_sitter.code_generation.current_code_codebase import get_documented_objects
from graph_sitter.codebase.factory.get_session import get_codebase_session
from graph_sitter.enums import ProgrammingLanguage
from graph_sitter.typescript.class_definition import TSClass
from graph_sitter.typescript.file import TSFile
from codegen_sdk.code_generation.current_code_codebase import get_documented_objects
from codegen_sdk.codebase.factory.get_session import get_codebase_session
from codegen_sdk.enums import ProgrammingLanguage
from codegen_sdk.typescript.class_definition import TSClass
from codegen_sdk.typescript.file import TSFile
from gscli.generate.runner_imports import EXTERNAL_IMPORTS
SAMPLE_FILENAME = {
ProgrammingLanguage.PYTHON: "sample.py",
Expand Down
8 changes: 4 additions & 4 deletions hatch.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build.hooks.vcs]
dependencies = ["hatch-vcs>=0.4.0"]
version-file = "src/graph_sitter/__init__.py"
version-file = "src/codegen_sdk/__init__.py"

[metadata]
allow-direct-references = true
Expand Down Expand Up @@ -32,7 +32,7 @@ dependencies = [
]

[build.targets.wheel.hooks.cython.options]
src = "graph_sitter"
src = "codegen_sdk"
compile_args = [
"-O3",
{ platforms = [
Expand Down Expand Up @@ -71,7 +71,7 @@ macos-max-compat = false

[build]
packages = [
"src/graph_sitter",
"src/codegen_sdk",
"src/graph_visualization",
"src/gscli",
]
Expand All @@ -83,7 +83,7 @@ source_archive = "https://github.com/codegen-sh/codegen-sdk/archive/{commit_hash

[build.targets.wheel.hooks.custom]
enable-by-default = false
path = "src/graph_sitter_build/build.py"
path = "src/codegen_sdk_build/build.py"
require-runtime-dependencies = true
[envs.default]
installer = "uv"
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exclude = (?x)(
| scripts/.*
| .*/codemods/.*/test_.*/
| ^/expected/
| src/graph_sitter/skills/*
| src/codegen_sdk/skills/*
)
plugins = pydantic.mypy

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "graph-sitter"
name = "codegen-sdk"
dynamic = ["version", "urls"]
description = "Add your description here"
readme = "README.md"
Expand Down Expand Up @@ -62,7 +62,7 @@ classifiers = [

[project.scripts]
gs = "gscli.main:main"
run_string = "graph_sitter.core.main:main"
run_string = "codegen_sdk.core.main:main"
[project.optional-dependencies]
types = [
"types-networkx>=3.2.1.20240918",
Expand Down
6 changes: 3 additions & 3 deletions scripts/profiling/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import networkx as nx
from tabulate import tabulate

from graph_sitter.codebase.factory.get_dev_customer_codebase import get_codebase_codegen
from graph_sitter.enums import ProgrammingLanguage
from codegen_sdk.codebase.factory.get_dev_customer_codebase import get_codebase_codegen
from codegen_sdk.enums import ProgrammingLanguage

logging.basicConfig(level=logging.INFO)
codegen = get_codebase_codegen("../codegen", ".")
Expand All @@ -21,7 +21,7 @@
if "test" not in file.filepath:
if file.ctx.repo_name == "codegen":
color = "yellow"
elif file.ctx.repo_name == "graph_sitter":
elif file.ctx.repo_name == "codegen_sdk":
color = "red"
if file.ctx.base_path == "codegen-git":
color = "green"
Expand Down
2 changes: 1 addition & 1 deletion src/graph_sitter/_proxy.py → src/codegen_sdk/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from lazy_object_proxy.simple import make_proxy_method

try:
from graph_sitter.extensions.utils import cached_property
from codegen_sdk.extensions.utils import cached_property
except ModuleNotFoundError:
from functools import cached_property

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from openai import OpenAI
from tenacity import retry, stop_after_attempt, wait_random_exponential

from graph_sitter.ai.converters import convert_openai_messages_to_claude
from graph_sitter.utils import XMLUtils
from codegen_sdk.ai.converters import convert_openai_messages_to_claude
from codegen_sdk.utils import XMLUtils

CLAUDE_OPENAI_MODEL_MAP = {
"gpt-4o": "claude-3-5-sonnet-20240620",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@

from codegen_git.repo_operator.local_repo_operator import LocalRepoOperator
from codegen_git.schemas.repo_config import BaseRepoConfig
from graph_sitter.codebase.config import CodebaseConfig, DefaultConfig, ProjectConfig
from graph_sitter.core.codebase import Codebase, CodebaseType
from graph_sitter.enums import ProgrammingLanguage
from graph_sitter.writer_decorators import DocumentedObject, apidoc_objects, no_apidoc_objects, py_apidoc_objects, ts_apidoc_objects
from codegen_sdk.codebase.config import CodebaseConfig, DefaultConfig, ProjectConfig
from codegen_sdk.core.codebase import Codebase, CodebaseType
from codegen_sdk.enums import ProgrammingLanguage
from codegen_sdk.writer_decorators import DocumentedObject, apidoc_objects, no_apidoc_objects, py_apidoc_objects, ts_apidoc_objects

logger = logging.getLogger(__name__)


def get_graphsitter_repo_path() -> str:
"""Points to base directory of the Codegen repo (.git) that is currently running"""
import graph_sitter
import codegen_sdk

filepath = graph_sitter.__file__
codegen_base_dir = filepath.replace("/graph_sitter/__init__.py", "")
filepath = codegen_sdk.__file__
codegen_base_dir = filepath.replace("/codegen_sdk/__init__.py", "")
codegen_base_dir = codegen_base_dir.replace("/src", "")
return codegen_base_dir


def get_codegen_codebase_base_path() -> str:
import graph_sitter
import codegen_sdk

filepath = graph_sitter.__file__
codegen_base_dir = filepath.replace("/graph_sitter/__init__.py", "")
filepath = codegen_sdk.__file__
codegen_base_dir = filepath.replace("/codegen_sdk/__init__.py", "")
return "src" if "src" in codegen_base_dir else ""


Expand All @@ -43,19 +43,19 @@ def get_current_code_codebase(config: CodebaseConfig = DefaultConfig, subdirecto
return codebase


def import_all_graph_sitter_modules():
# for file in graph_sitter:
def import_all_codegen_sdk_modules():
# for file in codegen_sdk:

GRAPH_SITTER_DIR = Path(get_graphsitter_repo_path())
codegen_sdk_DIR = Path(get_graphsitter_repo_path())
if base := get_codegen_codebase_base_path():
GRAPH_SITTER_DIR /= base
GRAPH_SITTER_DIR /= "graph_sitter"
for file in GRAPH_SITTER_DIR.rglob("*.py"):
relative_path = file.relative_to(GRAPH_SITTER_DIR)
codegen_sdk_DIR /= base
codegen_sdk_DIR /= "codegen_sdk"
for file in codegen_sdk_DIR.rglob("*.py"):
relative_path = file.relative_to(codegen_sdk_DIR)
# ignore braintrust_evaluator because it runs stuff on import
if "__init__" in file.name or "braintrust_evaluator" in file.name:
continue
module_name = "graph_sitter." + str(relative_path).replace("/", ".").removesuffix(".py")
module_name = "codegen_sdk." + str(relative_path).replace("/", ".").removesuffix(".py")
try:
importlib.import_module(module_name)
except Exception as e:
Expand All @@ -71,16 +71,16 @@ class DocumentedObjects(TypedDict):

def get_documented_objects() -> DocumentedObjects:
"""Get all the objects decorated with apidoc, py_apidoc, ts_apidoc, and no_apidoc decorators,
by importing all graph_sitter modules and keeping track of decorated objects at import time using
by importing all codegen_sdk modules and keeping track of decorated objects at import time using
the respective decorators
"""
import_all_graph_sitter_modules()
from graph_sitter.core.codebase import CodebaseType, PyCodebaseType, TSCodebaseType
import_all_codegen_sdk_modules()
from codegen_sdk.core.codebase import CodebaseType, PyCodebaseType, TSCodebaseType

if PyCodebaseType not in apidoc_objects:
apidoc_objects.append(DocumentedObject(name="PyCodebaseType", module="graph_sitter.core.codebase", object=PyCodebaseType))
apidoc_objects.append(DocumentedObject(name="PyCodebaseType", module="codegen_sdk.core.codebase", object=PyCodebaseType))
if TSCodebaseType not in apidoc_objects:
apidoc_objects.append(DocumentedObject(name="TSCodebaseType", module="graph_sitter.core.codebase", object=TSCodebaseType))
apidoc_objects.append(DocumentedObject(name="TSCodebaseType", module="codegen_sdk.core.codebase", object=TSCodebaseType))
if CodebaseType not in apidoc_objects:
apidoc_objects.append(DocumentedObject(name="CodebaseType", module="graph_sitter.core.codebase", object=CodebaseType))
apidoc_objects.append(DocumentedObject(name="CodebaseType", module="codegen_sdk.core.codebase", object=CodebaseType))
return {"apidoc": apidoc_objects, "py_apidoc": py_apidoc_objects, "ts_apidoc": ts_apidoc_objects, "no_apidoc": no_apidoc_objects}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import textwrap

from graph_sitter.code_generation.doc_utils.utils import (
from codegen_sdk.code_generation.doc_utils.utils import (
format_python_codeblock,
)
from graph_sitter.code_generation.enums import DocumentationDecorators
from graph_sitter.core.codebase import Codebase
from graph_sitter.enums import ProgrammingLanguage
from graph_sitter.python.class_definition import PyClass
from codegen_sdk.code_generation.enums import DocumentationDecorators
from codegen_sdk.core.codebase import Codebase
from codegen_sdk.enums import ProgrammingLanguage
from codegen_sdk.python.class_definition import PyClass


def get_canonical_codemod_classes(codebase: Codebase, language: ProgrammingLanguage) -> dict[str, PyClass]:
Expand Down
Loading