diff --git a/docs/building-with-codegen/dot-codegen.mdx b/docs/building-with-codegen/dot-codegen.mdx index c4a4ca7a5..a555e0e60 100644 --- a/docs/building-with-codegen/dot-codegen.mdx +++ b/docs/building-with-codegen/dot-codegen.mdx @@ -11,12 +11,11 @@ The `.codegen` directory contains your project's Codegen configuration, codemods ```bash .codegen/ -├── config.toml # Project configuration -├── codemods/ # Your codemod implementations -├── jupyter/ # Jupyter notebooks for exploration -├── docs/ # API documentation -├── examples/ # Example code -└── prompts/ # AI system prompts +├── .venv/ # Python virtual environment (gitignored) +├── config.toml # Project configuration +├── codemods/ # Your codemod implementations +├── jupyter/ # Jupyter notebooks for exploration +└── codegen-system-prompt.txt # AI system prompt ``` ## Initialization @@ -31,6 +30,20 @@ codegen init [--fetch-docs] [--repo-name NAME] [--organization-name ORG] The `--fetch-docs` flag downloads API documentation and examples specific to your project's programming language. +## Virtual Environment + +Codegen maintains its own virtual environment in `.codegen/.venv/` to ensure consistent package versions and isolation from your project's dependencies. This environment is: + +- Created using `uv` for fast, reliable package management +- Initialized with Python 3.13 +- Automatically managed by Codegen commands +- Used for running codemods and Jupyter notebooks +- Gitignored to avoid committing environment-specific files + +The environment is created during `codegen init` and used by commands like `codegen run` and `codegen notebook`. + +To debug codemods, you will need to set the python virtual environment in your IDE to `.codegen/.venv` + ### Configuration The `config.toml` file stores your project settings: @@ -49,13 +62,15 @@ Codegen automatically adds appropriate entries to your `.gitignore`: ```gitignore # Codegen -.codegen/prompts/ +.codegen/.venv/ .codegen/docs/ -.codegen/examples/ +.codegen/jupyter/ +.codegen/codegen-system-prompt.txt ``` -While prompts, docs, and examples are ignored, your codemods in `.codegen/codemods/` are tracked in Git. +- While most directories are ignored, your codemods in `.codegen/codemods/` and `config.toml` are tracked in Git +- The virtual environment and Jupyter notebooks are gitignored to avoid environment-specific issues ## Working with Codemods diff --git a/docs/introduction/overview.mdx b/docs/introduction/overview.mdx index 690a8d4a6..1dab4925d 100644 --- a/docs/introduction/overview.mdx +++ b/docs/introduction/overview.mdx @@ -9,7 +9,7 @@ iconType: "solid" It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/). -export const intoSnippet = `# Codegen builds a complete graph connecting +export const metaCode = `# Codegen builds a complete graph connecting # functions, classes, imports and their relationships from codegen import Codebase @@ -21,13 +21,23 @@ for function in codebase.functions: function.remove() ` +export const code = `def foo(): + pass + +def bar(): + foo() + +def baz(): + pass +` +