Skip to main content

Pythonic interface to fzf

Project description

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.6, 2.7, 3.3 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.

mouse

False to disable mouse. True by default.

Corresponds to --no-mouse 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.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.

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

iterfzf-0.4.0.17.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distributions

iterfzf-0.4.0.17.3-py2.py3-none-win_amd64.whl (2.6 MB view details)

Uploaded Python 2 Python 3 Windows x86-64

iterfzf-0.4.0.17.3-py2.py3-none-win32.whl (2.4 MB view details)

Uploaded Python 2 Python 3 Windows x86

iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_x86_64.whl (926.1 kB view details)

Uploaded Python 2 Python 3

iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_i686.whl (862.5 kB view details)

Uploaded Python 2 Python 3

iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.macosx_10_12_intel.macosx_10_12_x86_64.whl (914.6 kB view details)

Uploaded Python 2 Python 3 macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.11+ intel macOS 10.11+ x86-64 macOS 10.12+ intel macOS 10.12+ x86-64

iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_i386.macosx_10_11_i386.macosx_10_12_i386.whl (857.3 kB view details)

Uploaded Python 2 Python 3 macOS 10.10+ i386 macOS 10.11+ i386 macOS 10.12+ i386

File details

Details for the file iterfzf-0.4.0.17.3.tar.gz.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3.tar.gz
Algorithm Hash digest
SHA256 d58497135ea417777e9f518356ca3613198ffa155667a7ac918495cab9c22abb
MD5 8380caf89c10475f66459c576de8fb92
BLAKE2b-256 a17da4a5de90f3cdd825cf9bfcb6ea6270533ec8127b1e328eecf7b499084c59

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 37fd991f845fafc3fce21f3ab0f421cd29a4a6943b7d9f8c4da057b969b98b87
MD5 b6b75f240e4f8eef5247dfd17175a8ec
BLAKE2b-256 280cfecd214a7b78da5d22e6362dc2c6dde04a7434f51652fc73659f760028e1

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-win32.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 77fca51c9e4e8396bc5602b22b95d07614838f9b2e4ca00b6fca5e52fff03ba6
MD5 1bf207132c30a6afd67782a84fdbf6e6
BLAKE2b-256 8dd9d37418f9e98038b021d0afa6fd0966d943ae82edc44bb1090647bb4c88e5

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 92efa4a42230e21bdc493502cf5c6995572baa20557e0678963975012ca40dab
MD5 5b4982cf3449f318428130c975cd3073
BLAKE2b-256 452e6c9ce456bf1af2aecec5c98057b2b39ac77367e6f21f296d274f5aae41c2

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_i686.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2e648d026eb75f2c9de9c4568a1840788070ca1c8b7aaf3d940e9e4f5c082d73
MD5 72ff23bfab711dc1926c85a5f9500356
BLAKE2b-256 bf339cdf70148c65cb7458bb84b88abef3b9e5c57a0b98cdeb92d42a9bb3034d

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.macosx_10_12_intel.macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.macosx_10_12_intel.macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23506cc899b0b4af11c8e2230d986c4da02c11df314d09ed72cdf6c798c77bd2
MD5 53ad02f19bb277713743986c0ab4f731
BLAKE2b-256 1156d2afd57276f9a8d818a6793b02abcddd24fc98370536a9acab90c3aa388a

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_i386.macosx_10_11_i386.macosx_10_12_i386.whl.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.3-py2.py3-none-macosx_10_10_i386.macosx_10_11_i386.macosx_10_12_i386.whl
Algorithm Hash digest
SHA256 15845bb0c56cd415cded441d52ec8a66cd8764a41267f9298b74feed9f1b0bf7
MD5 2609c8317c5261876610b6321b6ab320
BLAKE2b-256 a1dc2b34435d149e51c044be85d0804c57b07536498e55e8bd648cbc507c602f

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