Skip to main content

Tool to summarize directories of code for prompting with LLMs

Project description

Test Summarize GPT Publish to PyPI

Code Summarization Tool

This tool generates a summary of a directory's contents, including a tree view of its subdirectories and files, and the contents of each file. It can optionally exclude files listed in a .gitignore file, exclude or include Docker files, or filter files based on their extensions.

Installation

This tool can be run directly from the command line without installation. Just ensure you have Python installed and can run Python scripts. Otherwise, you can install this tool as a package using pip:

pip install summarizeGPT

Usage

To use this tool, run the following command:

SummarizeGPT <directory_path> [options]

Options:

  • <directory_path>: Path to the directory to summarize
  • --gitignore <gitignore_path>: Path to the gitignore file
  • --include <file_extensions>: Comma-separated list of file extensions to include
  • --exclude <file_extensions>: Comma-separated list of file extensions to exclude
  • -d, --show_docker: Include docker files
  • -o, --show_only_docker: Show only docker files
  • -n, --max-lines <number>: Maximum number of lines to include from each file
  • --encoding {cl100k_base,p50k_base,r50k_base}: Tiktoken encoding to use for token counting (default: cl100k_base)
  • -v, --verbose: Enable verbose output

Note: On Windows the command can be case insensitive (try 'summarizegpt'), but on Linux it must be 'SummarizeGPT'.

Examples

Basic usage:

SummarizeGPT .

With gitignore:

SummarizeGPT /path/to/directory --gitignore /path/to/.gitignore

Filter by file extensions:

SummarizeGPT /path/to/directory --include py,txt
SummarizeGPT /path/to/directory --exclude xml,js

Docker-related files:

SummarizeGPT /path/to/directory -d  # Include Docker files
SummarizeGPT /path/to/directory -o  # Show only Docker files

Limit output and enable verbose logging:

SummarizeGPT /path/to/directory -n 100 -v

Output

The tool generates a file called Context_for_ChatGPT.md in the specified directory containing:

  • A tree view of the directory structure
  • Contents of included files
  • Summary statistics including:
    • Total lines
    • Total characters
    • Total bytes
    • Approximate token count (using specified tiktoken encoding)

Limitations

  • Does not interpret file contents
  • Does not handle symbolic links
  • Large directories or files can result in large output files
  • Token counting is approximate and depends on the chosen encoding

Future Enhancements

  • AI-powered code summarization to reduce output size and improve readability
  • Support for additional file types and encodings
  • Improved handling of large files and directories

Contributing

Contributions are welcome! Feel free to submit a pull request if you've made an improvement or fixed a bug.

License

This project is licensed under the terms of the GPLv3 license.

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

summarizegpt-1.3.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SummarizeGPT-1.3-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file summarizegpt-1.3.tar.gz.

File metadata

  • Download URL: summarizegpt-1.3.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.7

File hashes

Hashes for summarizegpt-1.3.tar.gz
Algorithm Hash digest
SHA256 a198354c59f245c59b18e01ea88928485f590e09d51d6e7385e151a43cb52104
MD5 bd354a4fb957ca3b75a6a35d50926891
BLAKE2b-256 0d30128ca66c6a3b570fa68ed1623a4a9608bec26add174698f3a5bc247bf1ce

See more details on using hashes here.

File details

Details for the file SummarizeGPT-1.3-py3-none-any.whl.

File metadata

  • Download URL: SummarizeGPT-1.3-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.7

File hashes

Hashes for SummarizeGPT-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f6ad6a548e7def80bee026f284269a084c1ae17ccd21735fe9585d7b7265913f
MD5 cac8cddcbe8e146bcde58e78a4491618
BLAKE2b-256 b7b08e79eb8feadd33398076a7a3fab5c96b190c5eeb8b627f605fb2afa126b6

See more details on using hashes here.

Supported by

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