Skip to main content

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

  1. Clone the repository:
git clone https://github.com/DEV3L/ai-code-summary
cd ai-code-summary
  1. 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
  1. 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
  • 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

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

ai_code_summary-0.1.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

ai_code_summary-0.1.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

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

Hashes for ai_code_summary-0.1.1.tar.gz
Algorithm Hash digest
SHA256 80e942bf1709bc1a5635eb7c6d5b1361d56fc2f1d47e0ff8a297fa21e00467e1
MD5 72b80c98fc61681b682246d5e9864e48
BLAKE2b-256 991fa0860e3ee5be29a01fba52094a73c8ea6c5e35229d832373d28ad7d68005

See more details on using hashes here.

File details

Details for the file ai_code_summary-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_code_summary-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a423b5a897ac9cbf8e81d751a187b38a93f6b916e87f4130114b689d231d47f
MD5 b0027a0290128b701c064da4efd61ebe
BLAKE2b-256 d5468aada45049e468171006c8e47eff026251654809399deb28969c9af0094d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page