Skip to main content

A prompt engineering toolkit for LLMs

Project description

arhupy

PyPI version Python versions License No dependencies GitHub stars

A lightweight prompt engineering toolkit for LLMs like Claude, GPT, and Gemini.

arhupy gives you a practical set of tools for writing, scoring, comparing, saving, exporting, improving, and reusing prompts. It works from both Python and the command line, uses only the Python standard library, and stores local data as simple JSON files in your current working directory.

Write prompt -> Score it -> Compare versions -> Save or export -> Reuse later
                         -> Improve with Claude
                         -> Serve through CLI, web, or local API

Why arhupy?

Prompt engineering can get messy fast. arhupy keeps the useful parts small and organized:

Need arhupy gives you
Fill reusable prompts Prompt("You are a {role}")
Chain prompt steps PromptChain and arhupy chain
Score prompt quality score_prompt() and arhupy score
Compare prompt versions compare_prompts() and arhupy diff
Save prompt libraries Local arhupy_library.json storage
Share prompts JSON export and import helpers
Track sessions Local prompt history with reuse
Improve with AI Claude-powered prompt improvement
Run locally CLI, web dashboard, and HTTP API
Extend behavior Simple plugin system

Installation

Install from PyPI:

pip install arhupy

Install from source:

git clone https://github.com/Typeshi-dotcom/arhupy.git
cd arhupy
pip install -e .

Check the CLI:

arhupy --help

Quick Start

from arhupy import Prompt

prompt = Prompt("You are a {role}. Explain {topic} in {style}.")
filled = prompt.fill(
    role="fitness coach",
    topic="progressive overload",
    style="simple terms",
)

print(filled)

Output:

You are a fitness coach. Explain progressive overload in simple terms.

Feature Map

Feature Python API CLI command
Prompt templates Prompt arhupy fill coding
Prompt chains PromptChain, build_chain() arhupy chain
Prompt scoring score_prompt() arhupy score "..."
Prompt comparison compare_prompts() arhupy diff "..." "..."
Prompt storage save(), load() arhupy save, arhupy list
Sharing export_prompt(), import_prompt() arhupy export, arhupy import
History add_history(), get_history() arhupy history, arhupy reuse
Claude integration ClaudeClient, improve_prompt() arhupy improve
Web dashboard run_server() arhupy web
Local API run_api_server() arhupy api
Plugins ArhupyPlugin, get_plugin() arhupy plugin echo "hello"

CLI Command Reference

Score a prompt

arhupy score "You are a fitness coach. Explain progressive overload step by step."

What it checks:

Check What it looks for
Length Too short, ideal length, or too long
Role Phrases like you are, act as, or role
Task clarity Words like write, explain, generate, analyze, or give
Structure Placeholders like {role}, {task}, or {question}
Output format Instructions like bullet points, step by step, or format
Constraints Words like limit, max, within, or only

Example output:

Score: 8/10

Strengths:
- Good prompt length
- Role is defined
- Clear task defined

Improvements:
- Use placeholders like {role}, {task}, or {question}.

Compare two prompts

arhupy diff "You are a coach" "You are a strict fitness coach"

The comparison shows:

  • Length difference
  • Word count difference
  • Common words
  • Words unique to each prompt
  • Score for each prompt
  • Which prompt looks stronger

Improve a prompt with Claude

arhupy improve "You are a coach" --api-key YOUR_KEY

arhupy uses the built-in ClaudeClient with urllib, so no external request library is needed. For safe local testing, the placeholder YOUR_KEY returns a demo improvement without making a real API call.

Save, list, export, and import prompts

arhupy save workout "You are a fitness coach. Create a {plan} for {goal}."
arhupy list
arhupy export prompts.json
arhupy import prompts.json

Saved prompts live in:

arhupy_library.json

The file is created in your current working directory.

Use built-in templates

arhupy templates
arhupy template coding
arhupy fill coding

Built-in templates:

Name Template
fitness You are a fitness coach. Create a {plan} for {goal}.
coding You are a senior developer. Explain {concept} in simple terms.
writing You are a writer. Write a {type} about {topic}.
business You are a business expert. Analyze {idea} and suggest improvements.

Build a prompt chain

arhupy chain

Enter one prompt per line. Submit an empty line to finish.

Example:

Enter prompt 1: You are a coach.
Enter prompt 2: Explain progressive overload.
Enter prompt 3: Use bullet points.
Enter prompt 4:

Output:

You are a coach.
Explain progressive overload.
Use bullet points.

Work with prompt history

Commands that score, diff, or improve prompts automatically save them to history.

arhupy history
arhupy history 5
arhupy reuse 1
arhupy reuse 1 --score
arhupy compare-history 1 2

History lives in:

arhupy_history.json

Export and import session history

arhupy export-history history.json
arhupy import-history history.json

Imported history entries are merged safely. Duplicate entries are skipped.

Start interactive mode

arhupy interactive

Interactive mode lets you choose actions from a menu:

1. Score prompt
2. Improve prompt
3. Compare with another prompt
4. Save prompt
5. Exit
6. Fill template
7. Build prompt chain
8. Compare history prompts
9. Export history
10. Import history

Start the web dashboard

arhupy web

Then open:

http://localhost:8000

The dashboard includes:

  • Score, Compare, and Improve tabs
  • Prompt scoring with strengths and improvements
  • Prompt comparison
  • AI prompt improvement with a Claude API key field
  • Saved prompt display
  • Save prompt button

Improved Web Dashboard

The local dashboard uses only Python's standard-library http.server, but gives you a cleaner browser interface for day-to-day prompt work.

arhupy web

Open http://localhost:8000 and use:

Tab Inputs Output
Score One prompt textarea Score, strengths, and improvements
Compare Two prompt textareas Differences, prompt scores, and better prompt
Improve Prompt textarea plus API key field Claude-improved prompt text

Start API mode

arhupy api

Then call the local API at:

http://localhost:8001

Endpoints:

Endpoint Method Body
/score POST { "prompt": "You are a coach" }
/diff POST { "p1": "Prompt one", "p2": "Prompt two" }
/improve POST { "prompt": "You are a coach", "api_key": "YOUR_KEY" }

Example with curl on macOS/Linux:

curl -X POST http://localhost:8001/score \
  -H "Content-Type: application/json" \
  -d '{"prompt":"You are a coach"}'

Example with curl on Windows PowerShell:

curl.exe -X POST "http://localhost:8001/score" -H "Content-Type: application/json" --data-raw '{""prompt"":""You are a coach""}'

Run a plugin

arhupy plugin echo "hello"

Output:

Echo: hello

Python API Examples

Prompt

from arhupy import Prompt

prompt = Prompt("You are a {role}. Speak in {language}.")

print(prompt.fill(role="coding assistant", language="English"))
prompt.preview()
prompt.reset()

PromptChain

from arhupy import Prompt, PromptChain

system = Prompt("System: {instruction}")
user = Prompt("User: {task}")

system.fill(instruction="Be concise and practical.")
user.fill(task="Explain prompt chaining.")

chain = PromptChain([system, user])
print(chain.build())

Simple prompt chain from strings

from arhupy import build_chain

final_prompt = build_chain([
    "You are a senior developer.",
    "Explain recursion in simple terms.",
    "Use one short example.",
])

print(final_prompt)

Prompt scoring

from arhupy import score_prompt

result = score_prompt(
    "You are a {role}. Explain {task} step by step in bullet points within 200 words only."
)

print(result["overall_score"])
print(result["strengths"])
print(result["feedback"])

Prompt comparison

from arhupy import compare_prompts

result = compare_prompts(
    "You are a coach",
    "You are a strict fitness coach",
)

print(result)

Save and load prompts

from arhupy import Prompt, load, save

prompt = Prompt("Summarize this in {style}: {text}")
save("summarizer", prompt)

loaded = load("summarizer")
print(loaded.fill(style="plain English", text="Prompt engineering is useful."))

Export and import one prompt

from arhupy import Prompt, export_prompt, import_prompt

prompt = Prompt("Write a {tone} email about {topic}.")
prompt.fill(tone="friendly", topic="a project update")

export_prompt(prompt, "email_prompt.json")
restored = import_prompt("email_prompt.json")

print(restored)

Export and import a prompt chain

from arhupy import Prompt, PromptChain, export_chain, import_chain

system = Prompt("System: {instruction}")
user = Prompt("User: {request}")

system.fill(instruction="Be concise.")
user.fill(request="Summarize this report.")

chain = PromptChain([system, user])
export_chain(chain, "summary_chain.json")

restored = import_chain("summary_chain.json")
print(restored.build())

Token estimation

from arhupy import estimate_tokens

tokens = estimate_tokens("A short prompt for an LLM.")
print(tokens)

Built-in templates

from arhupy import Prompt, get_template, list_templates

print(list_templates())

template = get_template("coding")
prompt = Prompt(template)
print(prompt.fill(concept="recursion"))

Prompt history

from arhupy import add_history, get_history, get_prompt_by_index

add_history("You are a coach. Explain progressive overload.")

print(get_history(limit=1))
print(get_prompt_by_index(1))

History comparison

from arhupy import add_history, compare_history

add_history("You are a coach.")
add_history("You are a fitness coach. Explain warmups step by step.")

print(compare_history(1, 2))

Claude integration

from arhupy import Prompt, ClaudeClient

client = ClaudeClient(api_key="your-api-key")

prompt = Prompt("You are a {role}. Answer this: {question}")
response = client.ask_with_template(
    prompt,
    role="fitness coach",
    question="What is progressive overload?",
)

print(response)

AI prompt improvement

from arhupy import improve_prompt

improved = improve_prompt("You are a coach", api_key="your-api-key")
print(improved)

Plugin system

Bundled echo plugin:

from arhupy import get_plugin

plugin = get_plugin("echo")
print(plugin.run("hello"))

Create a new plugin inside arhupy/plugins/:

from arhupy.plugins import ArhupyPlugin


class EchoPlugin(ArhupyPlugin):
    name = "echo"

    def run(self, text):
        return f"Echo: {text}"

Local Files Created By arhupy

arhupy keeps local project data in your current working directory:

File Purpose
arhupy_library.json Saved prompt templates
arhupy_versions.json Versioned prompt snapshots
arhupy_history.json Prompt history

These files are ignored by the included .gitignore so private prompt data does not get committed by accident.

Design Goals

  • No external runtime dependencies
  • Beginner-friendly Python APIs
  • Simple JSON storage
  • Clear command-line output
  • Local-first workflows
  • Easy GitHub and PyPI publishing
  • Extensible plugin architecture

Development

Clone and install in editable mode:

git clone https://github.com/Typeshi-dotcom/arhupy.git
cd arhupy
pip install -e .

Run tests:

python -m unittest

Build package artifacts:

python -m build

Contributing

Contributions are welcome. See CONTRIBUTING.md for setup instructions, test commands, and pull request guidance.

License

This project is licensed under the MIT License. See LICENSE for details.

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

arhupy-2.1.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

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

arhupy-2.1.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file arhupy-2.1.0.tar.gz.

File metadata

  • Download URL: arhupy-2.1.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for arhupy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 53a3562af4c8ff431e44b778da50934acc4fe3cd0be42e8a1ecb549b35d758f8
MD5 0aa54453014812525b0b014a75fbc17e
BLAKE2b-256 fcdc86e6647efc6eebaa6a42378bf23466301b8db952780a850ee149861775c9

See more details on using hashes here.

File details

Details for the file arhupy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: arhupy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for arhupy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c43baca136c2b3940488c6beb7315b31f94f2bab2809c0247773de9634d87146
MD5 5dc6a9d66cbb3802af873e3a1b63ba5f
BLAKE2b-256 c9435c3996ba9a327b4a68a2747b325dda10f525707635818dff7e7147571bb7

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