• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pythonic interface to fzf, a CLI fuzzy finder

iterfzf: Pythonic interface to fzf

Latest PyPI version Build status (Travis CI) Build status (AppVeyor)

Demo session

iterfzf demo session

See also the API reference.

Key features

  • No dependency but only Python is required. Prebuilt fzf binary for each platform is bundled into wheels. Everything is ready by pip install iterfzf. (Note that not wheels of all supported platforms are uploaded to PyPI as they don't allow minor platforms e.g. FreeBSD. The complete wheels can be found from the GitHub releases.)
  • Consumes an iterable rather than a list. It makes UX way better when the input data is long but streamed from low latency network. It can begin to display items immediately after only part of items are ready, and before the complete items are ready.
  • Supports Python 2.7, 3.5 or higher.

iterfzf.iterfzf(iterable, **options)

Consumes the given iterable of strings, and displays them using fzf. If a user chooses something it immediately returns the chosen things.

The following is the full list of parameters. Please pass them as keyword arguments except for iterable which comes first:

iterable (required)

The only required parameter. Every element which this iterable yields is displayed immediately after each one is produced. In other words, the passed iterable is lazily consumed.

It can be an iterable of byte strings (e.g. [b'foo', b'bar']) or of Unicode strings (e.g. [u'foo', u'bar']), but must not be mixed (e.g. [u'foo', b'bar']). If they are byte strings the function returns bytes. If they are Unicode strings it returns Unicode strings. See also the encoding parameter.

multi

True to let the user to choose more than one. A user can select items with tab/shift-tab. If multi=True the function returns a list of strings rather than a string.

False to make a user possible to choose only one. If multi=False it returns a string rather than a list.

For both modes, the function returns None if nothing is matched or a user cancelled.

False by default.

Corresponds to -m/--multi option.

print_query

If True the return type is a tuple where the first element is the query the user actually typed, and the second element is the selected output as described above and depending on the state of multi.

False by default.

Corresponds to --print-query option.

New in version 0.3.0.

encoding

The text encoding name (e.g. 'utf-8', 'ascii') to be used for encoding iterable values and decoding return values. It's ignored when the iterable values are byte strings.

The Python's default encoding (i.e. sys.getdefaultencoding()) is used by default.

extended

True for extended-search mode. False to turn it off.

True by default.

True corresponds to -x/--extended option, and False corresponds to +x/--no-extended option.

exact

False for fuzzy matching, and True for exact matching.

False by default.

Corresponds to -e/--exact option.

case_sensitive

True for case sensitivity, and False for case insensitivity. None, the default, for smart-case match.

True corresponds to +i option and False corresponds to -i option.

query

The query string to be filled at first. (It can be removed by a user.)

Empty string by default.

Corresponds to -q/--query option.

prompt

The prompt sequence. ' >' by default.

Corresponds to --prompt option.

preview

The preview command to execute. None by default.

Corresponds to --preview option.

mouse

False to disable mouse. True by default.

Corresponds to --no-mouse option.

ansi

True to enable ansi colors mode. None by default.

Corresponds to --ansi option.

Author and license

The iterfzf library is written by Hong Minhee and distributed under GPLv3 or later.

The fzf program is written by Junegunn Choi and distributed under MIT license.

Changelog

Versioning scheme

Note that iterfzf does not follow Semantic Versioning. The version consists of its own major and minor number followed by the version of bundled fzf. For example, 1.2.3.4.5 means that iterfzf's own major version is 1, and its own minor version is 2, plus the version of fzf it bundles is 3.4.5.

/---------- 1. iterfzf's major version
|   /------ 3. bundled fzf's major version
|   |   /-- 5. bundled fzf's patch version
|   |   |
v   v   v
1.2.3.4.5
  ^   ^
  |   |
  |   \---- 4. bundled fzf's minor version
  \-------- 2. iterfzf's minor version

Version 0.6.0.20.0

To be released. Bundles fzf 0.20.0.

Added ansi option. [#16 by Erik Lilja]

Version 0.5.0.20.0

Released on February 9, 2020. Bundles fzf 0.20.0.

  • Dropped Python 2.6, 3.3, and 3.4 supports.
  • Officially support Python 3.7 (it anyway had worked though).
  • Marked the package as supporting type checking by following PEP 561.
  • Added preview option. [#6 by Marc Weistroff]
  • Fixed a bug which had raised IOError by selecting an option before finished to load all options on Windows. [#3 by Jeff Rimko]

Version 0.4.0.17.3

Released on December 4, 2017. Bundles fzf 0.17.3.

Version 0.4.0.17.1

Released on October 19, 2017. Bundles fzf 0.17.1.

  • Added missing binary wheels for macOS again. (These were missing from 0.3.0.17.1, the previous release.)

Version 0.3.0.17.1

Released on October 16, 2017. Bundles fzf 0.17.1.

  • Added print_query option. [#1 by George Kettleborough]

Version 0.2.0.17.0

Released on August 27, 2017. Bundles fzf 0.17.0.

Version 0.2.0.16.11

Released on July 23, 2017. Bundles fzf 0.16.11.

Version 0.2.0.16.10

Released on July 23, 2017. Bundles fzf 0.16.10.

Version 0.2.0.16.8

Released on June 6, 2017. Bundles fzf 0.16.8.

  • Upgraded fzf from 0.16.7 to 0.16.8.

Version 0.2.0.16.7

Released on May 20, 2017. Bundles fzf 0.16.7.

  • Made sdists (source distributions) possible to be correctly installed so that older pip, can't deal with wheels, also can install iterfzf.

Version 0.1.0.16.7

Released on May 19, 2017. Bundles fzf 0.16.7. The initial release.

More Repositories

1

awesome-sqlalchemy

A curated list of awesome tools for SQLAlchemy
Python
2,664
star
2

fedify

ActivityPub server framework in TypeScript
TypeScript
512
star
3

logtape

Simple logging library with zero dependencies for Deno, Node.js, Bun, browsers, and edge functions
TypeScript
501
star
4

wikidata

Wikidata client library for Python
Python
333
star
5

hollo

Federated single-user microblogging software
TypeScript
194
star
6

seonbi

SmartyPants for Korean language
Haskell
131
star
7

cjk-compsci-terms

CJK computer science terms comparison / 中日韓電腦科學術語對照 / 日中韓のコンピュータ科学の用語対照 / 한·중·일 전산학 용어 대조
Python
128
star
8

sqlalchemy-imageattach

SQLAlchemy extension for attaching images to entities.
Python
116
star
9

lisphp

Lisphp is a Lisp dialect written in PHP.
PHP
80
star
10

iso4217

ISO 4217 currency data package for Python
Python
59
star
11

muzei-pixiv

Enjoy kawaii artworks of Pixiv through Muzei!
Java
52
star
12

fedi-badge

A badge generator for ActivityPub-enabled social media platforms, i.e., fediverse
TypeScript
43
star
13

sider

ABANDONED. Sider is a persistent object library based on Redis.
Python
39
star
14

logging-spinner

Display spinners (in CLI) through Python standard logging
Python
34
star
15

nvimrc

My Neovim configuration. Supports macOS and Linux.
Vim Script
33
star
16

sentry-heroku

Run Sentry on Heroku for free
Python
32
star
17

deno-task-hooks

A simple way to run Deno tasks as Git hooks
TypeScript
25
star
18

homebrew-jetbrains-eap

JetBrains EAP Casks for Homebrew Cask
Ruby
23
star
19

wsgi-oauth2

Simple WSGI middleware for OAuth 2.0
Python
22
star
20

jikji

Small static site generator toolkit
TypeScript
21
star
21

aitertools

Well-tested utility functions dealing with async iterables
TypeScript
18
star
22

github-distutils

This project is abandoned. Don't use this anymore!
Python
15
star
23

json-hash

JCS (JSON Canonicalization Scheme), JSON digests, and JSON Merkle hashes
TypeScript
14
star
24

blog

Hong Minhee's blog
Python
13
star
25

logtape-otel

LogTape OpenTelemetry Sink
TypeScript
12
star
26

macos-terminal-profiles

My profiles for macOS Terminal.app
12
star
27

naver-translate

ABANDONED. Haskell interface to Naver Translate
Haskell
11
star
28

microblog

A simple federated microblog example using Fedify for educational purpose
TypeScript
10
star
29

plastic

Plastic is a Python web framework built on top of Werkzeug.
Python
8
star
30

unihan-json

JSON data files parsed from the Unicode Han Database (Unihan)
Python
7
star
31

nicovideo-translator

Nico Nico Douga (ニコニコ動画) Comment Translator
Haskell
7
star
32

dojang

A cross-platform dotfiles manager
Haskell
7
star
33

markdown-gfm-admonition

An extension of Python Markdown that enables the admonition syntax of GFM
Python
7
star
34

markdown-it-mention

A markdown-it plugin that parses and renders Mastodon-style @mentions
TypeScript
7
star
35

tofu

A very impractical small programming language.
6
star
36

resume

Hong Minhee's résumé
Makefile
6
star
37

phunctional

Functional programming in PHP 5.2.x
PHP
6
star
38

submark

Extract a part from CommonMark/Markdown docs
Haskell
6
star
39

fedify-h3

Integrate Fedify with h3
TypeScript
6
star
40

fedikit

A prototype of Fedify written in Python (codenamed FediKit)
Python
5
star
41

iso639-1

Type-safe ISO 639-1 language code (a.k.a. two-letter codes) for TypeScript
TypeScript
5
star
42

sphinx-fakeinv

Generate fake Intersphinx inventory
Python
5
star
43

monthday

Date without year
Python
5
star
44

pghstore

This repository is abandoned and the upstream is moved to @heroku →
Python
5
star
45

actions

Small Useful GitHub Actions
JavaScript
5
star
46

bencodex-haskell

Bencodex reader/writer for Haskell
Haskell
5
star
47

fedify-microblog-tutorial-ja

『自分だけのフェディバースのマイクロブログを作ろう!』のAsciiDocのソースコード
Shell
5
star
48

x-forwarded-fetch

A middleware for fetch() behind a reverse proxy with X-Forwarded-* headers
TypeScript
5
star
49

dc-feed

PHP
4
star
50

mediawiki-rc-mastodon-bot

Relay RecentChanges from a MediaWiki site to a Mastodon account
TypeScript
4
star
51

shinjitai-table

The table between shinjitai (新字体) and kyūjitai (舊字體).
Python
4
star
52

travis-auto-rebuilder

Automatically retry failed builds
Python
4
star
53

web_deno_test

Run your tests on Deno and web browsers at a time
TypeScript
4
star
54

fedify-redis

Redis drivers for Fedify
TypeScript
4
star
55

fedify-amqp

AMQP/RabbitMQ driver for Fedify
TypeScript
3
star
56

dahlia.github.io

Hong Minhee's website
HTML
3
star
57

bencodex-php

Bencodex reader/writer for PHP
PHP
3
star
58

gitter-slack

One-way relay from Gitter to Slack
Rust
3
star
59

writings

洪民憙雜記
TypeScript
3
star
60

encodingcontext

A bad idea about the default encoding
Python
3
star
61

feed-translator

ABANDONED. Translate syndication feeds.
Haskell
3
star
62

wikipedia-kana-romanizer

Wikipedia kana romanizer
JavaScript
3
star
63

last.fm-memories

Lists music you had listened before from Last.fm (or Libre.fm)
Python
3
star
64

checkmate

Generate checklists relevant to a given patch
Haskell
3
star
65

jsr-badge

A badge generator for JSR (JavaScript Registry)
TypeScript
3
star
66

fedify-express

Integrate Fedify with Express
TypeScript
2
star
67

markdown-it-jsr-ref

A markdown-it plugin that turns backtick-enclosed symbols into links to JSR API references
TypeScript
2
star
68

narabi

A simple Pythonic asynchronous interface to inter-process pub/sub
Python
2
star
69

web-lessc

A simple HTTP API of LESS compiler
JavaScript
2
star
70

localtunnel

A simple wrapper around the local tunneling services
TypeScript
2
star
71

wiki.hongminhee.org

洪兔雜記
TypeScript
2
star
72

fedify-postgres

PostgreSQL drivers for Fedify
TypeScript
1
star
73

naver-premium-contents-feed

네이버 프리미엄 콘텐츠 RSS 피드
TypeScript
1
star
74

jld

JSON-LD CLI tools
TypeScript
1
star
75

python-1.5.2-docker

Run Python 1.5.2 using Docker
1
star
76

misc

Nothing special
1
star
77

opensearch-descs

Hong Minhee's Collection of OpenSearch Descriptions
JavaScript
1
star
78

foss-license-texts-esm

F/OSS License Texts as ESM
JavaScript
1
star
79

lazylist

Proxy list to a list-returning function
Python
1
star
80

dotfiles

Hong Minhee's dotfiles
Shell
1
star
81

html-charset

Determine character encoding of HTML documents/fragments
Haskell
1
star
82

markdown-it-hashtag

A markdown-it plugin that parses and renders Mastodon-style #hashtags
TypeScript
1
star
83

fedify-queue-benchmarks

Benchmarks for Fedify's outbox queue
TypeScript
1
star