from solvekit import *solvekit
Usage
Installation
Install latest from pypi:
$ pip install solvekitDocumentation
Documentation can be found hosted on this GitHub repositoryโs pages. Additionally you can find package manager specific guidelines on pypi respectively.
How to use
Add a toolbar button by calling add_btn with a name, icon, code snippet, and tooltip. Hereโs the simplest case โ a single-line Python snippet:
add_btn('dice', 'ii:lucide:dice-5', 'import random; dice_num = random.randint(1,6); print(f"๐ฒ You rolled a {dice_num}!")', 'Roll a dice!', lang='py')For longer scripts, use a triple-quoted string. This button picks a random answer and displays it with a short delay:
add_btn('magic8', '๐ฎ', '''
import random
import time
answers = ["It is certain! ๐","Ask again later ๐ค","Don't count on it ๐ฌ","Absolutely! โจ","Try again tomorrow ๐ด","Without a doubt! ๐"]
print(f"๐ฎ {random.choice(answers)}")
time.sleep(5)
''', 'Ask the Magic 8-Ball', lang='py')Buttons can also trigger AI prompts. This one asks the assistant to clean up the code cell above the current cursor position:
add_btn('cleanup', 'ii:lucide:wand-sparkles', '''
await add_msg(content="""Please clean up the code above:
1. **Fastcore docs format**: Add docstrings and a comment after each parameter (each param on its own line)
2. **General cleanup**: Improve naming, simplify logic, remove duplication
Keep the overall structure and behavior the same.""",
msg_type='prompt', run=True)
''', 'Clean up code above', lang='py')The same pattern works for any reusable prompt โ hereโs one that polishes prose and formatting:
add_btn('optimize', 'ii:lucide:pencil-line', '''
await add_msg(content="""Please optimize the cell input above:
1. **Clarity**: Make the content clearer and more concise
2. **Structure**: Improve formatting and organization
3. **Grammar & Style**: Fix any grammar issues and improve readability
Keep the original intent and meaning the same.""",
msg_type='prompt', run=True)
''', 'Optimize cell input above', lang='py')## Next steps
add_btn gives you a single toolbar button โ useful, but real workflows need more. Hereโs where solvekit is headed:
Dropdown menus. A single toolbar icon that expands into a list of actions, perfect for storing frequently-used prompts.
Token usage bar. A live progress bar showing context window consumption for the current session.
JS helper library. Clean wrappers around solveit internals โ solvekit.run_msg(), solvekit.upsert_msg() โ so custom buttons are readable and concise, no guessing at private APIs.