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
-
Basic Usage: Process files in
src/
andlib/
, including only.py
and.txt
files.flort src lib --py --txt
-
Include All Files: Process all files in
src/
andlib/
, ignoring file extensions.flort src lib --all
-
Include Hidden Files: Process files in
src/
, including hidden files and only.md
files.flort src --hidden --md
-
Output to File: Process files in
src/
and output tooutput.txt
.flort src --output output.txt --py --txt
-
Ignore Specific Directories: Process files in
src/
, ignoring__pycache__
andbuild
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file flort-0.1.8.0.tar.gz
.
File metadata
- Download URL: flort-0.1.8.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d3383ffabe39459830b80efddf132a5b02498423a27a252517f52e26e32ef39 |
|
MD5 | acdbed9dfc010f810f850cf15b8ff364 |
|
BLAKE2b-256 | 34b94b8b62c383e79fe11f94dc99634e00359f6d8f27c9ac85e1163aeb83c7ba |