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_KEYwith 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
Metadata
Release files for ai-code-summary 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai_code_summary-0.1.1.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_code_summary-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / ai_code_summary-0.1.1.tar.gz
| Download URL | ai_code_summary-0.1.1.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80e942bf1709bc1a5635eb7c6d5b1361d56fc2f1d47e0ff8a297fa21e00467e1
|
|
BLAKE2b-256 checksum How to use checksums |
991fa0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / ai_code_summary-0.1.1-py3-none-any.whl
| Download URL | ai_code_summary-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a423b5a897ac9cbf8e81d751a187b38a93f6b916e87f4130114b689d231d47f
|
|
BLAKE2b-256 checksum How to use checksums |
d5468aada45049e468171006c8e47eff026251654809399deb28969c9af0094d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|