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.3.tar.gz (6.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: flort-0.1.7.3.tar.gz
  • Upload date:
  • Size: 6.4 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.3.tar.gz
Algorithm Hash digest
SHA256 9c16622c9a88dd7e70c799f590fbce3c350deb9cbe188bfe78e51e701ad781d8
MD5 8291646c650461dde4b86e68d698aa7f
BLAKE2b-256 4de1d13e476f049185e117de3772ae6c5499d8e440b4bcaaa479801c62320e47

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