Skip to main content

Toolkit for extending solveit dialogs with custom toolbar buttons and dialog operations

Project description

solvekit

Usage

Installation

Install latest from pypi:

$ pip install solvekit

Documentation

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

from solvekit import *

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solvekit-0.0.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solvekit-0.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file solvekit-0.0.1.tar.gz.

File metadata

  • Download URL: solvekit-0.0.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for solvekit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b0705ee2dc365a07843a1111f5a9d4dc1415e699874a83e083e23520fca5d57a
MD5 785b19a3cca9f39b276c9a75cfd062ea
BLAKE2b-256 1daf0e9d8834aa39ce9587f6949fb60496248c1ad400ba60c29f9871363d64a9

See more details on using hashes here.

File details

Details for the file solvekit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: solvekit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for solvekit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd5edf0ac18fee70242c235617a23b08bbdb58c28f688840dc827749fc3de465
MD5 769498bcfdddc0c0e8f681392ed1913b
BLAKE2b-256 3e0d7653e7f18893230f2f05cf7b106f9f95f2881cc9710234058ac89a60fbb9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page