Skip to main content

A utility to flatten your source code directory into a single file for LLM usage

Project description

Flort

Flort is a utility tool designed to flatten your source code directory into a single file, making it convenient for Large Language Model (LLM) usage. It supports various options to include/exclude files based on extensions, binary detection, and hidden file visibility.

Features

  • Directory Flattening: Combine files from multiple directories into a single output file.
  • File Filtering: Filter files by extensions, hidden status, and binary detection.
  • Customizable Output: Option to output to a file or standard output.
  • Directory Tree Generation: Generate a visual directory tree structure.

Installation

You can install flort from PyPI:

pip install flort

Usage

The primary usage of flort is through the command line interface (CLI). Below are some common commands and options:

flort [DIRECTORY]... [--output OUTPUT] [--no-tree] [--all] [--hidden] [--EXTENSIONS]...
  • DIRECTORY: One or more directories to process.
  • --output: Output file path. If not specified, the result is printed to the standard output.
  • --no-tree: Do not print the directory tree at the beginning.
  • --all: Include all files regardless of extensions.
  • --hidden: Include hidden files.
  • --EXTENSIONS: List of file extensions to include. Each extension should be prefixed with --.

Examples

  1. Basic Usage: Process files in src/ and lib/, including only .py and .txt files.

    flort src lib --py --txt
    
  2. Include All Files: Process all files in src/ and lib/, ignoring file extensions.

    flort src lib --all
    
  3. Include Hidden Files: Process files in src/, including hidden files and only .md files.

    flort src --hidden --md
    
  4. Output to File: Process files in src/ and output to output.txt.

    flort src --output output.txt --py --txt
    

Development

To set up the development environment, clone the repository and install the dependencies:

git clone https://github.com/chris17453/flort.git
cd flort
pip install -r requirements.txt

Run the tests to ensure everything is working correctly:

make tests

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

This project is licensed under the BSD License. See the LICENSE file for more details.

Author

Chris Watkins - chris@watkinslabs.com

Acknowledgments

Special thanks to the open-source community for their invaluable contributions and support.

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

flort-0.1.7.1.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file flort-0.1.7.1.tar.gz.

File metadata

  • Download URL: flort-0.1.7.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for flort-0.1.7.1.tar.gz
Algorithm Hash digest
SHA256 3ab0d479cb8952b764b9274a698d5fc864207039ac4aaba282c137bb1772f6b8
MD5 081593be2582bf642fff74623a360b72
BLAKE2b-256 73712877f295ec72cbf62d72dff2b0042d5478189897302a41ac9f0be320776c

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