- pylibfinder is a Python library that allows you to spot a keyword as a python object inside the Python standard library.
- It provides a convenient way to search for objects that match a given keyword within the standard library modules.
- With pylibfinder, you can easily identify the modules and objects that are available in Python and gain insights into their usage and availability.
- This library is designed to assist developers in finding relevant objects and understanding the Python standard library better.
For stable version
- pip install pylibfinder
For development
Recommended (Easy setup):
- git clone https://github.com/Agent-Hellboy/pylibfinder
- cd pylibfinder
pip install -e .(installs in editable mode with proper Python headers detection)- make changes to
src/pylibfinder.c- reinstall with
pip install -e .to rebuild- open repl and test
Manual compilation:
macOS:
- Install Homebrew Python:
brew install [email protected]- Find Python include path:
python3.13 -c "import sysconfig; print(sysconfig.get_path('include'))"- Compile:
gcc -shared -o pylibfinder.so -fPIC -I /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.13/include/python3.13 src/pylibfinder.c src/module_scanner.c -lpython3.13- It will generate
pylibfinder.so- Test in Python REPL:
python3.13 -c "import pylibfinder; print(pylibfinder.find_similar('power'))
Linux:
- Install Python dev package:
sudo apt-get install python3.13-dev- Compile:
gcc -shared -o pylibfinder.so -fPIC -I /usr/include/python3.13 src/pylibfinder.c src/module_scanner.c- It will generate
pylibfinder.so- Test in Python REPL:
python3.13 -c "import pylibfinder; print(pylibfinder.find_similar('power'))
Semantic similarity search - Find similar functions:
>>> import pylibfinder
>>>
>>> # Search for 'power' to find math functions (default threshold 0.5)
>>> pylibfinder.find_similar('power')
[{'Module': 'builtins', 'Function': 'pow', 'Similarity': 0.6}, ...]
>>>
>>> # Search for 'print' with custom threshold
>>> result = pylibfinder.find_similar('print', 0.5)
>>> result[0]
{'Module': 'builtins', 'Function': 'print', 'Similarity': 1.0}
>>>
>>> # Find functions similar to 'parseInt' (Java function) with higher threshold
>>> pylibfinder.find_similar('parseInt', 0.6)
[{'Module': 're._parser', 'Function': '_parse_sub', 'Similarity': 0.6}]
>>>
>>> # Include private APIs (functions starting with _) in search results
>>> pylibfinder.find_similar('parse', 0.5, include_private=True)
[{'Module': 'builtins', 'Function': 'compile', 'Similarity': 0.5}, {'Module': 're._parser', 'Function': '_parse_sub', 'Similarity': 0.8}, ...]
>>>Interactive Search with Beautiful UI:
To use the interactive terminal interface, install with the TUI extra:
pip install pylibfinder[tui]Then launch the interactive TUI:
pylibfinder-tuiFeatures:
- Beautiful Interactive Interface - Built with Textual for a modern TUI experience
- Keyboard Navigation - Smooth and responsive controls
- Color-Coded Results - Visual indicators for match quality:
- Green: Excellent match (90%+)
- Cyan: Good match (70%+)
- Yellow: Fair match (50%+)
- Red: Low match (<50%)
- Progress Bars - Visual representation of similarity scores
- Real-time Search - Search directly in the TUI interface
Usage:
- Start the TUI:
pylibfinder-tui - Type your keyword in the search box (e.g.,
power,print,parseInt) - Every keyword event sends request to the backend
- View results in the formatted table
- Press
Ctrl+Lto clear results orCtrl+Cto exit
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
