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.
Project description
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
pip install ai-code-summary
For more details, visit the PyPI project page.
Setup
- Clone the repository:
git clone https://github.com/DEV3L/ai-code-summary
cd ai-code-summary
- Copy the env.local file to a new file named .env and replace
OPENAI_API_KEY
with your actual OpenAI API key:
cp env.default .env
- Setup a virtual environment with dependencies and activate it:
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
- Default:
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.
- Default:
Testing
End to End Test
hatch run e2e
Unit Tests
hatch run test
Coverage Gutters:
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ai_code_summary-0.1.1.tar.gz
.
File metadata
- Download URL: ai_code_summary-0.1.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80e942bf1709bc1a5635eb7c6d5b1361d56fc2f1d47e0ff8a297fa21e00467e1 |
|
MD5 | 72b80c98fc61681b682246d5e9864e48 |
|
BLAKE2b-256 | 991fa0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005 |
File details
Details for the file ai_code_summary-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: ai_code_summary-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a423b5a897ac9cbf8e81d751a187b38a93f6b916e87f4130114b689d231d47f |
|
MD5 | b0027a0290128b701c064da4efd61ebe |
|
BLAKE2b-256 | d5468aada45049e468171006c8e47eff026251654809399deb28969c9af0094d |