Pythonic interface to fzf
Project description
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 3.8 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. 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.
- sort
Sorts the result if True. False by default.
- 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.
- bind
The key/event bindings to pass to fzf.
Dictionary of the form {KEY: ACTION} or {EVENT: ACTION}.
Corresponds to --bind=KEYBINDS 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.
- cycle
True to enable cycling scrolling.
False by default.
Corresponds to --cycle option.
- __extra__
The iterable of extra raw options/arguments to pass to fzf.
Empty by default.
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.4.0.54.3
Released on August 24, 2024. Bundles fzf 0.54.3.
Version 1.4.0.51.0
Released on May 7, 2024. Bundles fzf 0.51.0.
Version 1.3.0.51.0
Released on May 6, 2024. Bundles fzf 0.51.0.
Version 1.2.0.46.1
Released on March 6, 2024. Bundles fzf 0.46.1.
Close stdin before waiting to allow --select-1 to work. [#34 by Alex Wood]
Version 1.1.0.44.0
Released on November 18, 2023. Bundles fzf 0.44.0.
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.
Except the first parameter iterable, all parameters are enforced to be keyword-only. (Note that it’s always been the recommended way to pass options, although it was not enforced.)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file iterfzf-1.4.0.54.3.tar.gz
.
File metadata
- Download URL: iterfzf-1.4.0.54.3.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a0b9dc4f1a126da959dd601643bf31de7fa69febb7c33f4b6e2fa8edc4be2e1 |
|
MD5 | 5de869fce78d5b2738b5788975a9fe45 |
|
BLAKE2b-256 | ed2d59f1b1eeaef868b24aba97e651c9c9bbf937b8a6967ffc23d1f9131c8f68 |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-win_arm64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-win_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf78d55832e172fe7bce451f3b68becde28412a192f7161ca7bd2313bd5e842f |
|
MD5 | a98ab29a383d3dd1f0e97767875c05ac |
|
BLAKE2b-256 | 6c2442c53c9df027b630e54276e03d54d0ab80b4ecf425b9f74e1591765e54a6 |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-win_amd64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-win_amd64.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8385d45359d6c392b10095d179f0b2857f64b33eba55e1b6a34eb5d82320377f |
|
MD5 | 843919cba395a2d77abe06ff50fca9f6 |
|
BLAKE2b-256 | 819cc94bf804b1c18024810ee3ebc4528faec4cedef18824776b9f3a37ad13fa |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c32312ce5599d84600d920b0db8986cf10b20e4b9fdb2aee5df6b67cc646d27 |
|
MD5 | 7e4451438a355e9a3d9fa57d239c5fc3 |
|
BLAKE2b-256 | 9c69ca3abe63b1a7296ff2b8cb173e69283abf5f235268c393b48fe355918aba |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7510bc99e503b12513fceca9add5ae6bcd9497e95a098ae682ca5b2916dc3c2 |
|
MD5 | b4b285d05ae8a4b34eb7c866cf4563b0 |
|
BLAKE2b-256 | 8a886962ea965f146fb9ca11062756eb4c5c86d54b20eb38d93e7c1297cb96a9 |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-manylinux_1_2_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-manylinux_1_2_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3, manylinux: glibc 1.2+ x86-64, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c87a093cdd13b9604f3e7f457dd49ec1bc1dad63899476a01f5743ad1f394bb9 |
|
MD5 | 360a25ce20cc1287a69b7f609b669da7 |
|
BLAKE2b-256 | ad3ca6eebbfa3ab26d49e0f752b23cbd964011bd1de0579c97bab7ffe917bc8c |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-manylinux_1_2_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-manylinux_1_2_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 1.2+ ARM64, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f981dcf71f44bd4aa7119cc8e19373a8a8726db6f829a505d131c263c2fe8d84 |
|
MD5 | 932fb0ec1de6730595eebe953e7b4af8 |
|
BLAKE2b-256 | a8446e7d873d292d17cb6af6c77d0f274408ae9da7dd9ac907eb48a2c83b39e7 |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d3edbd8184490bd9ab8cd399db462e010ae7c2273d933b040ca536d5c1a8915 |
|
MD5 | 9e1d9393b572013f5ac52996d04e374a |
|
BLAKE2b-256 | 45bb9d195462a6e8348aa9c16b47009f96cfa0cc84f62c53cdc7022c903c6c79 |
File details
Details for the file iterfzf-1.4.0.54.3-py3-none-macosx_10_7_x86_64.macosx_10_9_x86_64.whl
.
File metadata
- Download URL: iterfzf-1.4.0.54.3-py3-none-macosx_10_7_x86_64.macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3, macOS 10.7+ x86-64, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d070c575cb9e706651e2f753d0361639fcd7b79435ef4626a824a0a76b03dce |
|
MD5 | 47f4c8f761423c96fb621b8c4d030a91 |
|
BLAKE2b-256 | 202c3afd6d9911204f8324195a0cf91b39844faaf3ad56bffd35d5d8083d84aa |