Registry / data / pfzy
library0.3.4pypypi✓ verified 23d ago

pfzy is a Python port of the fzy fuzzy string matching algorithm, designed for efficient and accurate fuzzy searching primarily in fuzzy finder applications. It provides asynchronous fuzzy match functions, a fzy scorer, and a substring scorer that can calculate matching scores and provide corresponding indices. The library is currently at version 0.3.4 and supports Python versions `>=3.7,<4.0`. While the last PyPI release was in January 2022, its continued inclusion and updates in distributions like Arch Linux (up to January 2026) suggest it remains an active and relevant tool for specific fuzzy matching needs.

pip install pfzy
INSTALL
IMPORT
SIG · PFZY
P
pfzy
datapythonv0.3.4
Install
1.6s avg
Import
203ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.220s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.186s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fuzzy_match
from pfzy import fuzzy_match
FzyScorer
from pfzy import FzyScorer
Used for direct scoring without options filtering.
SubstringScorer
from pfzy import SubstringScorer
Used for exact substring matching.

Demonstrates how to use the `fuzzy_match` function asynchronously to find fuzzy matches and their indices from a list of options based on a given query.

import asyncio from pfzy import fuzzy_match async def main(): options = ["apple", "banana", "apricot", "grape"] query = "ap" results = await fuzzy_match(query, options) print(results) if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
gotchapfzy strictly requires Python versions between `3.7` and `3.9.x` (specifically tested and uploaded with Python 3.9.5, though PyPI metadata states `<4.0`). Users on Python 3.10+ or Python 3.6 and below may encounter installation or runtime issues.
fix
Ensure your Python environment is within the `Python >=3.7,<4.0` range for optimal compatibility.
affects: All versions of pfzy
gotchaThe core `fuzzy_match` function is an `async` function. It must be called using `await` within an `async` context (e.g., inside an `async def` function) or executed directly using `asyncio.run()` in a synchronous script. Failing to do so will result in a `coroutine object` being returned, not the actual results.
fix
Wrap calls to `fuzzy_match` with `asyncio.run(fuzzy_match(...))` for synchronous scripts, or `await fuzzy_match(...)` within existing `async` functions.
affects: All versions of pfzy
gotchapfzy is a port of the `fzy` algorithm, primarily designed for interactive fuzzy *finder applications* where matching scores and *indices* are crucial for highlighting. It is not a general-purpose string similarity library like `fuzzywuzzy` or `rapidfuzz` and may behave differently or offer different features than expected if used as a direct replacement for those.
fix
Understand the `fzy` algorithm's scoring characteristics and ensure it aligns with your specific fuzzy matching requirements, especially if you need matching indices for UI applications.
affects: All versions of pfzy
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pfzy'
The 'pfzy' library is not installed in the current Python environment or there is a typo in the import statement.
fix
Install the library using pip: `pip install pfzy`
AttributeError: module 'pfzy' has no attribute 'fuzzy_match'
This typically occurs when trying to access `pfzy.fuzzy_match` after `import pfzy`, or if there's a typo in the function name. The `fuzzy_match` function is intended to be imported directly.
fix
Use the direct import statement: `from pfzy import fuzzy_match`
RuntimeError: no running event loop
The `pfzy.fuzzy_match` function is an asynchronous coroutine and must be run within an `asyncio` event loop. This error occurs when you call it directly in synchronous code without managing the event loop.
fix
Execute the asynchronous function using `asyncio.run()`: `import asyncio; from pfzy import fuzzy_match; result = asyncio.run(fuzzy_match('query', ['target']))`
TypeError: fuzzy_match() missing 1 required positional argument: 'choices'
The `fuzzy_match` function requires two positional arguments: the query string and a list of choices to match against. This error indicates one or both were not provided.
fix
Ensure both the `query` string and the `choices` list are passed to the function: `fuzzy_match('apple', ['pineapple', 'grape'])`
Upgrade
Version history
0.3.4latest on PyPI · released Jan 28, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Resources
pfzy — pip install pfzy · libregistry