{"id":2189,"library":"pfzy","title":"pfzy - Fuzzy String Matching","description":"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.","status":"active","version":"0.3.4","language":"python","source_language":"en","source_url":"https://github.com/kazhala/pfzy","tags":["fuzzy","string matching","fzy","search","async"],"install":[{"cmd":"pip install pfzy","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"fuzzy_match","correct":"from pfzy import fuzzy_match"},{"note":"Used for direct scoring without options filtering.","symbol":"FzyScorer","correct":"from pfzy import FzyScorer"},{"note":"Used for exact substring matching.","symbol":"SubstringScorer","correct":"from pfzy import SubstringScorer"}],"quickstart":{"code":"import asyncio\nfrom pfzy import fuzzy_match\n\nasync def main():\n    options = [\"apple\", \"banana\", \"apricot\", \"grape\"]\n    query = \"ap\"\n    results = await fuzzy_match(query, options)\n    print(results)\n\nif __name__ == \"__main__\":\n    asyncio.run(main())","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your Python environment is within the `Python >=3.7,<4.0` range for optimal compatibility.","message":"pfzy 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.","severity":"gotcha","affected_versions":"All versions of pfzy"},{"fix":"Wrap calls to `fuzzy_match` with `asyncio.run(fuzzy_match(...))` for synchronous scripts, or `await fuzzy_match(...)` within existing `async` functions.","message":"The 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.","severity":"gotcha","affected_versions":"All versions of pfzy"},{"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.","message":"pfzy 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.","severity":"gotcha","affected_versions":"All versions of pfzy"}],"env_vars":null,"search_vec":"'0.3.4':57 '2022':72 '2026':86 '3.7':62 '4.0':63 'accur':21 'activ':91 'algorithm':16 'applic':28 'arch':81 'async':105 'asynchron':31 'calcul':44 'continu':74 'correspond':49 'current':54 'design':17 'distribut':79 'effici':19 'finder':27 'function':34 'fuzzi':2,13,22,26,32,97,100 'fzi':12,36,103 'inclus':75 'indic':50 'januari':71,85 'last':66 'librari':52 'like':80 'linux':82 'match':4,15,33,45,98,102 'need':99 'pfzi':1,5 'port':9 'primarili':24 'provid':30,48 'pypi':67 'python':8,60 'releas':68 'relev':93 'remain':89 'score':46 'scorer':37,41 'search':23,104 'specif':96 'string':3,14,101 'substr':40 'suggest':87 'support':59 'tool':94 'updat':77 'version':56,61","created_at":"2026-04-09T18:47:19.368327+00:00","updated_at":"2026-04-16T17:59:11.025071+00:00","problems":[{"fix":"Install the library using pip: `pip install pfzy`","cause":"The 'pfzy' library is not installed in the current Python environment or there is a typo in the import statement.","error":"ModuleNotFoundError: No module named 'pfzy'"},{"fix":"Use the direct import statement: `from pfzy import fuzzy_match`","cause":"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.","error":"AttributeError: module 'pfzy' has no attribute 'fuzzy_match'"},{"fix":"Execute the asynchronous function using `asyncio.run()`: `import asyncio; from pfzy import fuzzy_match; result = asyncio.run(fuzzy_match('query', ['target']))`","cause":"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.","error":"RuntimeError: no running event loop"},{"fix":"Ensure both the `query` string and the `choices` list are passed to the function: `fuzzy_match('apple', ['pineapple', 'grape'])`","cause":"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.","error":"TypeError: fuzzy_match() missing 1 required positional argument: 'choices'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/kazhala/pfzy","docs":"https://pfzy.readthedocs.io/","changelog":null,"pypi":"https://pypi.org/project/pfzy/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}