Skip to main content

PromptVersion

Simple prompt version control for AI development

PyPI version Python 3.8+ License: MIT

PromptVersion is a lightweight tool for managing AI prompts with version control, templating, and variable injection. Think "Git for prompts" - but simpler.

Why PromptVersion?

  • 📝 Templated YAML prompts with variable injection
  • 🏷️ Semantic versioning for prompt iterations
  • 🚀 Simple CLI for prompt management
  • 🐍 Clean Python API for integration
  • 📁 No external dependencies - just files and Git

Quick Start

Installation

pip install promptversion

Initialize a repository

promptversion init

Create your first prompt

promptversion create classifier --description "Ticket classifier"

Use in Python

from promptversion import PromptVersion

pv = PromptVersion()

# Render with variables
result = pv.render("classifier", {
    "ticket": "I can't log into my account",
    "max_categories": 3
})

# Use with any LLM
import openai
response = openai.ChatCompletion.create(
    model="gpt-4",
    messages=[{"role": "system", "content": result}]
)

Features

  • Templated YAML prompts with variable injection
  • Internal version control with semantic versioning
  • Simple CLI for prompt management
  • Clean Python API for integration

Prompt Format

Prompts are stored as YAML files in the prompts/ directory:

name: "classifier"
version: "1.0.0"
description: "Classifies support tickets"

variables:
  max_categories:
    default: 5
    type: "integer"
  language:
    default: "en" 
    type: "string"

template: |
  You are a support ticket classifier.
  
  Classify this ticket into up to {{max_categories}} categories.
  Respond in {{language}}.
  
  Ticket: {{ticket}}

CLI Commands

  • promptversion init - Initialize repository
  • promptversion create <n> - Create new prompt
  • promptversion edit <n> - Edit prompt
  • promptversion commit <n> - Commit changes
  • promptversion tag <n> <tag> - Tag version
  • promptversion list - List all prompts
  • promptversion show <n> - Show prompt details
  • promptversion test <n> - Test prompt rendering
  • promptversion versions <n> - Show version history

Python API

from promptversion import PromptVersion

# Initialize
pv = PromptVersion()

# Get prompt
prompt = pv.get("classifier")

# Render with variables
result = prompt.render({"ticket": "Login issue"})

# Get specific version
prompt_v1 = pv.get("classifier", version="1.0.0")

# List all prompts
prompts = pv.list_prompts()

Development

# Clone repository
git clone https://github.com/yourusername/promptversion
cd promptversion

# Install in development mode
pip install -e .[dev]

# Run tests
pytest

# Format code
black promptversion tests

License

MIT License

Metadata

Release files for promptversion 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promptversion 0.1.0
File Size Uploaded Provenance Actions
promptversion-0.1.0.tar.gz 16.0 kB Without provenance Details for promptversion-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for promptversion 0.1.0
File Interpreter ABI Platform Actions
promptversion-0.1.0-py3-none-any.whl Python 3 none any Details for promptversion-0.1.0-py3-none-any.whl

Total release size: 27.3 kB

Release files / promptversion-0.1.0.tar.gz

Download URL promptversion-0.1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b958392c71c03465931346d3aad0dd3d66063481c2a1139ae0e77175eb9adf9e
BLAKE2b-256 checksum
How to use checksums
cb802850e657fddbd41670b6d4140a4627c0ad6672f61d11da2e0017b41e4ea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / promptversion-0.1.0-py3-none-any.whl

Download URL promptversion-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b215fa7c5f14cb8a2d8eae52809e18235637cda83dc9e91d9b6b7b34cadf9b4
BLAKE2b-256 checksum
How to use checksums
936d2ce9c1ca2bfda963440ddfdf8c000f63464327c161b1d74e950abdab2558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for promptversion 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page