Skip to main content

A powerful, user-friendly Python tool to generate project trees and file contents (with MIME detection).

Project description

ProjectCompactor 🚀

PyPI Version GitHub Stars License Build Status

📦 Overview

ProjectCompactor is a powerful, user-friendly Python tool designed to generate comprehensive project trees and extract detailed file contents from any directory. Whether you're a developer, project manager, or enthusiast, ProjectCompactor streamlines the process of documenting and analyzing your project structure, making it easier to understand, share, and maintain your codebase.

🌟 Key Features

  • 🔍 Comprehensive Project Tree Generation

    • Automatically traverses directories to create a detailed hierarchical tree structure.
    • Visualizes the entire project layout with proper indentation for easy readability.
  • 📄 Detailed File Content Extraction

    • Extracts and includes contents of text-based files (e.g., .py, .html, .txt, .md).
    • Identifies binary or non-text files (e.g., .png, .jpg, .exe) and lists them without attempting to read their contents.
  • ⚙️ Highly Configurable

    • Customizable File Extensions: Specify additional file types to treat as text files.
    • Exclusion Filters: Exclude specific directories or file types from the analysis.
    • Verbose Logging: Enable detailed logging for troubleshooting and insights.
  • 🚀 Efficient and Fast

    • Utilizes multi-threading for concurrent file processing, ensuring quick execution even for large projects.
    • Progress indicators with tqdm provide real-time feedback during operation.
  • 🛠️ Easy to Use Command-Line Interface

    • Simple commands to generate project structures with optional parameters for customization.
    • Output can be directed to a specified file for easy sharing and documentation.
  • 📈 SEO-Friendly Documentation

    • Generates structured and detailed documentation ideal for project analysis and onboarding.

📋 Installation

Install ProjectCompactor easily using pip:

pip install projectcompactor

Ensure you have Python 3.6 or higher installed.

🖥️ Usage

After installation, you can use the projectcompactor command directly from your terminal.

Basic Command

Generate a project structure of the current directory:

projectcompactor

Specify a Directory Analyze a specific directory:

projectcompactor /path/to/your/project

Customize Output File Specify a custom output file name:

projectcompactor -o my_structure.txt

Add Additional Text File Extensions Include additional file extensions to treat as text files:

projectcompactor -e .rst .conf

Exclude Specific Directories and File Types Exclude directories like node_modules and file types like .log:

projectcompactor --exclude-dirs node_modules .git --exclude-files .log .tmp

Enable Verbose Logging Get detailed logs during execution:

projectcompactor -v

Full Example Combine multiple options for a comprehensive analysis:

projectcompactor /path/to/your/project -o project_structure.txt -e .rst .conf --exclude-dirs node_modules .git --exclude-files .log .tmp -v

📂 Sample Output Project Structure Section

# Project Structure

project/
    README.md
    src/
        main.py
        utils.py
    assets/
        logo.png
        styles.css

File Details Section

# File Details

## README.md
### Contents of README.md
# Sample Project
This is a sample project.

## src/main.py
### Contents of main.py
print("Hello, World!")

## src/utils.py
### Contents of utils.py
def helper():
    pass

## assets/logo.png
[Binary or Non-text file: logo.png]

## assets/styles.css
### Contents of styles.css
body { margin: 0; padding: 0; }

🎯 Use Cases 📚 Project Documentation 🔍 Uploading to Chat Assistant 🗃️ Archiving Projects 📊 Reporting

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

projectcompactor-6.9421.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

projectcompactor-6.9421-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file projectcompactor-6.9421.tar.gz.

File metadata

  • Download URL: projectcompactor-6.9421.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for projectcompactor-6.9421.tar.gz
Algorithm Hash digest
SHA256 2e8ef8640a51f7f702fad4af65226d366da973da2ba983d7752191bf22f5dfca
MD5 7d20b765ec08b3eaccc2f142fc23249d
BLAKE2b-256 f9dae95c680d2c6bb61b4d47f0d565b4d688ff5ad0a756ff65c2b533d6d82e3a

See more details on using hashes here.

File details

Details for the file projectcompactor-6.9421-py3-none-any.whl.

File metadata

File hashes

Hashes for projectcompactor-6.9421-py3-none-any.whl
Algorithm Hash digest
SHA256 4bd1b6ecf9643d5f82eddf41e2fd7d9acfd122b856339266b6bea615d8e1a75f
MD5 23d573fe1c8792d7bc46fc6542bcd298
BLAKE2b-256 ff66490b0729a99406284b3cc3d3eb5c47acd47894e00c7bd61d51ab7e4c2141

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