# AI Code Summary
This project automates the process of aggregating code files from a directory into a single markdown file, ready for use in an OpenAI Assistant or any RAG model. It intelligently skips files specified in the `.gitignore` and leverages ChatGPT to generate concise summaries for each code file, ensuring that the final markdown file is both comprehensive and easy to understand.
## Install through PyPI
```bash
pip install ai-code-summary
```
For more details, visit the [PyPI project page](https://pypi.org/project/ai-code-summary/).
## Setup
1. Clone the repository:
```bash
git clone https://github.com/DEV3L/ai-code-summary
cd ai-code-summary
```
2. Copy the env.local file to a new file named .env and replace `OPENAI_API_KEY` with your actual OpenAI API key:
```bash
cp env.default .env
```
3. Setup a virtual environment with dependencies and activate it:
```bash
brew install hatch
hatch env create
hatch shell
```
## Environment Variables
The following environment variables can be configured in the `.env` file:
- `OPENAI_MODEL`: The model to use
- Default: `gpt-4o`
- `SUMMARY_PROMPT`: The prompt used to summarize code files
- Default: `You are code summary expert. You summarize code in a short way that is easy to understand.`
## Testing
### End to End Test
```bash
hatch run e2e
```
### Unit Tests
```bash
hatch run test
```
### Coverage Gutters:
```bash
Command + Shift + P => Coverage Gutters: Watch
```
## Example
```
from ai_code_summary.markdown.export import create_markdown_from_code
if __name__ == "__main__":
create_markdown_from_code(".")
```
Example output as a markdown file - [ai-code-summary.md](ai-code-summary.md)
Raw data
{
"_id": null,
"home_page": null,
"name": "ai-code-summary",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "AI, API, artificial intelligence, automation, code summary, data science, openai, python",
"author": null,
"author_email": "Justin Beall <jus.beall@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/99/1f/a0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005/ai_code_summary-0.1.1.tar.gz",
"platform": null,
"description": "# AI Code Summary\n\nThis project automates the process of aggregating code files from a directory into a single markdown file, ready for use in an OpenAI Assistant or any RAG model. It intelligently skips files specified in the `.gitignore` and leverages ChatGPT to generate concise summaries for each code file, ensuring that the final markdown file is both comprehensive and easy to understand.\n\n## Install through PyPI\n\n```bash\npip install ai-code-summary\n```\n\nFor more details, visit the [PyPI project page](https://pypi.org/project/ai-code-summary/).\n\n## Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/DEV3L/ai-code-summary\ncd ai-code-summary\n```\n\n2. Copy the env.local file to a new file named .env and replace `OPENAI_API_KEY` with your actual OpenAI API key:\n\n```bash\ncp env.default .env\n```\n\n3. Setup a virtual environment with dependencies and activate it:\n\n```bash\nbrew install hatch\nhatch env create\nhatch shell\n```\n\n## Environment Variables\n\nThe following environment variables can be configured in the `.env` file:\n\n- `OPENAI_MODEL`: The model to use\n - Default: `gpt-4o`\n- `SUMMARY_PROMPT`: The prompt used to summarize code files\n - Default: `You are code summary expert. You summarize code in a short way that is easy to understand.`\n\n## Testing\n\n### End to End Test\n\n```bash\nhatch run e2e\n```\n\n### Unit Tests\n\n```bash\nhatch run test\n```\n\n### Coverage Gutters:\n\n```bash\nCommand + Shift + P => Coverage Gutters: Watch\n```\n\n## Example\n\n```\nfrom ai_code_summary.markdown.export import create_markdown_from_code\n\nif __name__ == \"__main__\":\n create_markdown_from_code(\".\")\n```\n\nExample output as a markdown file - [ai-code-summary.md](ai-code-summary.md)\n",
"bugtrack_url": null,
"license": "/* * ---------------------------------------------------------------------------- * \"THE BEER-WARE LICENSE\" (Revision 42): * <jus.beall@gmail.com> wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Justin Lee Beall * ---------------------------------------------------------------------------- */",
"summary": "This project automates the process of aggregating code files from a directory into a single markdown file, ready for use in an OpenAI Assistant or any RAG model. It intelligently skips files specified in the .gitignore and leverages ChatGPT to generate concise summaries for each code file, ensuring that the final markdown file is both comprehensive and easy to understand.",
"version": "0.1.1",
"project_urls": {
"repository": "https://github.com/DEV3L/ai-code-summary"
},
"split_keywords": [
"ai",
" api",
" artificial intelligence",
" automation",
" code summary",
" data science",
" openai",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5468aada45049e468171006c8e47eff026251654809399deb28969c9af0094d",
"md5": "b0027a0290128b701c064da4efd61ebe",
"sha256": "5a423b5a897ac9cbf8e81d751a187b38a93f6b916e87f4130114b689d231d47f"
},
"downloads": -1,
"filename": "ai_code_summary-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b0027a0290128b701c064da4efd61ebe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 11616,
"upload_time": "2024-10-24T16:43:46",
"upload_time_iso_8601": "2024-10-24T16:43:46.749256Z",
"url": "https://files.pythonhosted.org/packages/d5/46/8aada45049e468171006c8e47eff026251654809399deb28969c9af0094d/ai_code_summary-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "991fa0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005",
"md5": "72b80c98fc61681b682246d5e9864e48",
"sha256": "80e942bf1709bc1a5635eb7c6d5b1361d56fc2f1d47e0ff8a297fa21e00467e1"
},
"downloads": -1,
"filename": "ai_code_summary-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "72b80c98fc61681b682246d5e9864e48",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 14426,
"upload_time": "2024-10-24T16:43:48",
"upload_time_iso_8601": "2024-10-24T16:43:48.005463Z",
"url": "https://files.pythonhosted.org/packages/99/1f/a0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005/ai_code_summary-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-24 16:43:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DEV3L",
"github_project": "ai-code-summary",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "ai-code-summary"
}