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.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.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Python 2 Python 3 Windows x86-64

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

Uploaded Python 2 Python 3 Windows x86

iterfzf-0.4.0.17.1-py2.py3-none-manylinux1_x86_64.whl (924.6 kB view details)

Uploaded Python 2 Python 3

iterfzf-0.4.0.17.1-py2.py3-none-manylinux1_i686.whl (861.6 kB view details)

Uploaded Python 2 Python 3

iterfzf-0.4.0.17.1-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 (913.5 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.1-py2.py3-none-macosx_10_10_i386.macosx_10_11_i386.macosx_10_12_i386.whl (915.6 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.1.tar.gz.

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.1.tar.gz
Algorithm Hash digest
SHA256 5b9b306e78ccc58fd84301fa44b5a2ad02f92b38a1760832e183f8fabe0fc38b
MD5 1ee175a6bab0a9c84d0c6da71a461bfa
BLAKE2b-256 83be52c8c324be332ab60a4a8b5f96c5b53f2b376d4a1949c327bd7a2e5e333d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.1-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 39c4957ebd54de02f22cb4f958b8c9d71d3e4269977ff59a65b07baafe4db2e2
MD5 abba8ab6f55dec66e6ebbf90cf55a702
BLAKE2b-256 df7ee7b45083a07a38718c24bb3fdf5c68a121593dafa83e66253a5a139ca4a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.1-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 eeada2d4b737ef7f656abefe72d654a04c9ae7dcbb7d7ad3ffe63b7540b66707
MD5 87df24edee2be025654d54a0daf415f7
BLAKE2b-256 9c5ec9823895a6c6756aa5175f416122cdb67907e0415436a87c7df20fb86848

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.1-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 03471a8d711f5b70c9871ded692667cdebeebf6021547464e11c54a0019e49a4
MD5 f763c23459cd8a594bfa13681e9841ba
BLAKE2b-256 66681723f5f6c8ebf228455c312fd8974940b454999d228fc3e0b86736112c6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iterfzf-0.4.0.17.1-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d860cf4fe6c0ca76b804be8b1f8742924bf7e09581681b2ecbc57586e8a21fe1
MD5 64c08f2a6e3cbd539116d38d419beed2
BLAKE2b-256 808e2e807b2805c091ac9183d418df52c7a25f5d906e86fc4f0e2fb20ef7696d

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.1-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.1-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 1c20ffafe6b9b84cb4317b81fbc3fb9444a5b64d2f7bfd212af1d84e6db529dd
MD5 c9bd72e6cf74dcc5446f05b8ccb2b5c4
BLAKE2b-256 72eefbaf4084222ef40c56b11a39533bf880e59785ce2a3179c003e2d839cb77

See more details on using hashes here.

File details

Details for the file iterfzf-0.4.0.17.1-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.1-py2.py3-none-macosx_10_10_i386.macosx_10_11_i386.macosx_10_12_i386.whl
Algorithm Hash digest
SHA256 12539922475be85fea5bf6458dffb0125c50e83c6533b6fe29f163df30203dd7
MD5 082e05c9e8cb601be747027ea75cfb3e
BLAKE2b-256 f66b45cfc3af945cffe53340fad9a1e3d4dc1bf350bb98fee22cb5050c745086

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