Python API and documentation
Hi, thanks for the nice Python app.
It will be nice if there is a documentation to use percol as a Python module. I am requesting this because I am using percol as a Python module for my advanced shell history app called RASH. I want to use percol as Python module as I want to issue request to SQLite DB as you type query in percol.
I have several suggestions:
- Move most of the code in
bin/percoltopercol.clior something like that. Ideally,bin/percoljust containsfrom percol.cli import main; main()(not one-linear, of course ^^). Otherwise, people need to reimplement functions such asload_rc. - Some arguments for
percol.Percolneed to be set even if it is optional. For example, I needed to passcandidates=[]. - Pass finder instance or add a way to pass arguments for the finder class. I am passing argument by dynamically modifying class attribute. Not cool.
- Add a way to change appearance of candidates. For example, I want to show "score" for each candidate when searching. It's something like
real-to-display/display-to-realin helm/anything. How about allowing any object that have__str__forcollection(so, you need to convert it to strings somewhere)? Module user can get that object by passing some custom actions.
Here is the related part in RASH: https://github.com/tkf/rash/blob/master/rash/interactive_search.py
Thanks for the informative request. That's what I've been planning for a long time! (and your RASH seems hot!)
Pass finder instance or add a way to pass arguments for the finder class. I am passing argument by dynamically modifying class attribute. Not cool.
You can reference finder instances by percol.model_candidate.finder and percol.model_action.finder. Any suggestions are welcome If it's not enough.
Add a way to change appearance of candidates.
It would be great. Your suggestion, which permits arbitrary objects with __str__, is pythonic and reasonable. I'll implement it anytime soon.
You can reference finder instances by percol.model_candidate.finder and percol.model_action.finder.
Ah, I didn't notice. I think this solves my problem.
i am a python newbie and i got a maybe too much basic question, but its hard for me, if i have an array like this: arr = [1, 2, 3, 4] i want to use a direct call to a percol library from my python program, how do i list this array on percol from python?
from percol.finder import *
what.percol.function.list(arr) ?
thanks for your support, percol is my favorite command line interface.