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] [--ignore-dirs DIRS] [--EXTENSIONS]...
  • DIRECTORY: One or more directories to process. Defaults to the current working directory if not specified.
  • --output: Output file path. If not specified, the result is printed to the standard output.
  • --ignore-dirs: Comma-separated list of directories to ignore.
  • --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
    
  5. Ignore Specific Directories: Process files in src/, ignoring __pycache__ and build directories.

    flort src --ignore-dirs __pycache__,build --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.9.1.tar.gz (7.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: flort-0.1.9.1.tar.gz
  • Upload date:
  • Size: 7.1 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.9.1.tar.gz
Algorithm Hash digest
SHA256 999c114372f6c316b481a562d477046dfc7c59ba9f556b80075e50565c75bf36
MD5 d0ab5e96728914f9f9bc17ef44381b30
BLAKE2b-256 b13facb7dd41d0d157d2df3f78be6f6e25dee7c5b1c0347e3da2bf8d5f139a33

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