pyfzf
Forked Changes:
This doesn't write to a temporary file before prompting, it communicates with the subprocess directly given any iterator, sending lines as they're processed.
It also lets you send any fzf CLI options as args/kwargs, or decorate a function which returns an iterator to use as fzf input (see below for examples)
A python wrapper for junegunn's fzf.
Requirements
- Python 3.6+
fzf
Note: fzf must be installed and available on $PATH.
Installation
pip install pyfzf_iter
Usage
from pyfzf.pyfzf import FzfPrompt
fzf = FzfPrompt()
fzf = FzfPrompt(default_options="--reverse")
If fzf is not available on PATH, you can specify a location
fzf = FzfPrompt('/path/to/fzf')
Simply pass a sequence of items to the prompt function to invoke fzf
fzf.prompt(range(0,10))
You can pass additional positional arguments to fzf.
fzf.prompt(range(0,10), '--multi', '--cycle')
fzf.prompt(range(0,50), 'multi', 'cycle', height='20%')
fzf.prompt(range(0,50), 'x', 'i', 'm', '--tac')
Items are streamed to the fzf process one line at a time, you can pass
any sort of iterator or generator as the first argument. For example, a file object,
or a glob of files to search for, displaying a preview:
fzf.prompt(open("README.md"), "-m", delimiter="")
from pathlib import Path
fzf.prompt(Path(".").rglob("*.md"), "-m", r"--preview='cat {}'")
Items are delimited with \n by default, you can also change the delimiter (useful for multiline items):
>>> fzf.prompt(["5\n10", "15\n20"], '--read0', '-m', delimiter='\0')
['15\n20']
You can also wrap a decorate a function with wrap, which then runs fzf when you call the function:
from pyfzf import FzfPrompt
fzf = FzfPrompt()
@fzf.wrap("--tac")
def items(n: int):
return range(n)
# prompts you to pick one of the items with fzf
items(n=50)
Metadata
Release files for pyfzf-iter 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfzf_iter-0.0.1.tar.gz | 7.6 kB | Without provenance | Details for pyfzf_iter-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfzf_iter-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyfzf_iter-0.0.1-py3-none-any.whl |
Total release size: 15.7 kB
Release files / pyfzf_iter-0.0.1.tar.gz
| Download URL | pyfzf_iter-0.0.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03e20516949ffa704c85ed03575962684f186bb8b7318d915c677bc60a2296cf
|
|
BLAKE2b-256 checksum How to use checksums |
7a241b7f29b009ba4c88e1ccc482ec6ad4ce52374ab43e2f69789a9d0022c098
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Release files / pyfzf_iter-0.0.1-py3-none-any.whl
| Download URL | pyfzf_iter-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3553c686cd7b5e9ec89c1fdb6ea0aae203021a32236690414f61a982165556b1
|
|
BLAKE2b-256 checksum How to use checksums |
24b31bb96d8bb5b9bba4ef3e25d0bbb303ece9532e18d66ef7d67c9b933d7400
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Security for pyfzf-iter 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.