iterfzf

1.9.0.67.0 · active · verified Tue Apr 14

iterfzf is a Pythonic interface to fzf, a command-line fuzzy finder. It allows consuming iterables of strings and displaying them using fzf for interactive selection, returning the user's choice(s). Notably, it consumes iterables lazily, which is efficient for large or streamed inputs. The current version is 1.9.0.67.0, released on January 24, 2026, and bundles a prebuilt fzf binary for convenience. The library supports Python 3.8 and higher.

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `iterfzf` to present a list of items for interactive fuzzy selection. It shows how to enable multi-selection and how to catch the `KeywordInterrupt` exception if the user cancels the selection (e.g., by pressing Escape).

from iterfzf import iterfzf, KeywordInterrupt

items = [
    "apple",
    "banana",
    "cherry",
    "date",
    "elderberry",
    "fig",
    "grape",
]

try:
    # Use multi=True to allow selecting multiple items
    selected_items = iterfzf(
        items,
        multi=True,
        header="Select fruits (Tab to multi-select, Enter to confirm, Esc to cancel):",
        prompt=">> "
    )

    if selected_items:
        print("You selected:", selected_items)
    else:
        print("No items selected.")
except KeywordInterrupt:
    print("Selection cancelled by user.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →