Skip to main content

Pythonic interface to fzf

Project description

Latest PyPI version Build status (GitHub Actions)

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 1.0.0.42.0

Released on September 18, 2023. Bundles fzf 0.42.0.

  • Dropped Python 2.7, 3.5, 3.6, and 3.7 supports.

  • Officially support Python 3.8, 3.9, 3.10, and 3.11.

  • Dropped FreeBSD i386, Linux i686, Linux armv8l, OpenBSD i386, and Windows 32-bit supports as fzf no longer supports them.

  • Dropped OpenBSD amd64 support.

  • Added ansi option. [#16 by Erik Lilja]

  • The executable parameter now takes os.PathLike instead of str, which is backward compatible.

  • Added __version__ and __fzf_version__ attributes to the module.

  • Added POSIX_EXECUTABLE_NAME and WINDOWS_EXECUTABLE_NAME attributes to the module.

  • Module attribute EXECUTABLE_NAME is now a Literal['fzf', 'fzf.exe'] type, which is backward compatible with the previous str type.

  • Module attribute BUNDLED_EXECUTABLE is now Optional[pathlib.Path] type.

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.

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-1.0.0.42.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

iterfzf-1.0.0.42.0-py3-none-win_arm64.whl (1.5 MB view details)

Uploaded Python 3 Windows ARM64

iterfzf-1.0.0.42.0-py3-none-win_amd64.whl (2.9 MB view details)

Uploaded Python 3 Windows x86-64

iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 1.2+ x86-64 manylinux: glibc 2.17+ x86-64

iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 1.2+ ARM64 manylinux: glibc 2.17+ ARM64

iterfzf-1.0.0.42.0-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

iterfzf-1.0.0.42.0-py3-none-macosx_10_7_x86_64.macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded Python 3 macOS 10.7+ x86-64 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: iterfzf-1.0.0.42.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for iterfzf-1.0.0.42.0.tar.gz
Algorithm Hash digest
SHA256 2ff532b5c279001eea3eee60d47aeb5ee2c2cb3221ea3bcca6b481fba76491c1
MD5 8215c9272f31e28d5964db655a3655f6
BLAKE2b-256 93b9b228712dd14e3d481c447fe2cc2e7d8267d911f7e3533e152d7cbc14dfde

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 7f8b7a2f588813fbcc4f4ac6dcb50548e9e25122a46847ff84aa4cc3b6fe7885
MD5 643fd46cb3115e7cad6457f77730ae32
BLAKE2b-256 20f14137ae61a43fc0df70359a515d3879fc549a1ece377cfd27436f570d19df

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1582c7c5c8c4c6030199a8c3f8fd4995a4f6ca219fc0e1193fccfd95469acbd3
MD5 dae9bc8e63873d6f5384e417c5bbb055
BLAKE2b-256 9ff319d83080a4f470d93c8c70d2454f9f0631c7b073fb4cf33baecb1b379bf8

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 bbc9a33f0d41fa9786b3b53fa5dbc2e966940f0819c27c4d8c73cac50cbd0529
MD5 8cb74ee1464c738fd6a7196932460549
BLAKE2b-256 07318eba73af7bd4abb3d79a9940296ab1ed9655c2a6e5f897e2dd0042076e25

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 833b509b13699aeef286c593d3f78b1a1a62c996a8b0dc7a3220e58ae40e9124
MD5 d5db1378d4cd65258489692f7d99cb76
BLAKE2b-256 c57b8938f638f08e12c2e9dc32f18564fdeeaa84476429c9d85a60e2d7e91405

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd2bb6c3c629c3ea22bec92c5b613778b4803c35413c017b639a090d8c5c8bc5
MD5 3051794c0c70720501a01d513513e0aa
BLAKE2b-256 114b0563a2d2add13b8bf54247c939b41b808c0adb0de8d1fb78c7fd4e8962d3

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-manylinux_1_2_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 87e080870765a7a0310004cbd17d82245811fcc87ab389c5b5b176fb43f035f5
MD5 1a7184406bba89491c83a993c6bc1162
BLAKE2b-256 afcb14fcf366ee65cccd31ae93fdf2db15de990f5fdc2cd3b60135ad91ee9bbb

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c597833186dea99a57a6538c9a1c047584cbdfd8c38c2cf22b0ff33106fd9592
MD5 1970f60a600d4075368cfcf8ef536d44
BLAKE2b-256 1d6fb548ea23acdfa4e49452c9e1bad63383e4ddd56dff0561dfd8b8df3bc36e

See more details on using hashes here.

File details

Details for the file iterfzf-1.0.0.42.0-py3-none-macosx_10_7_x86_64.macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for iterfzf-1.0.0.42.0-py3-none-macosx_10_7_x86_64.macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b84398a6779cf6ccbaa89653fc662a88c2783c37546e24ba458ef3a60338400
MD5 47e0ac98209b70a9a77dd293818345c5
BLAKE2b-256 eb03ae9890561702a1ab3605d573ee2cb8baec66002c1d8662dbbad9eef2b44c

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