Skip to main content

Grompt - Git for Prompts

PyPI version License: MIT Tests Coverage Python Versions

Store prompts as YAML files, version them, and use them in code by ID.

That's it. Everything else is optional.


The Core Idea

Grompt lets you store prompts as YAML files, version them, and use them in code by ID.

  • ✅ Prompts live in files (prompts/code-review.yaml) - not buried in code
  • ✅ Version changes with grompt commit code-review
  • ✅ Use in code: prompt = grompt.load("code-review")

That's the core. Everything else is nice-to-have.


Why Grompt?

Problem: Prompts buried in code are hard to version, test, and optimize.

Solution: Prompts as files, referenced by ID.

Benefits:

  • ✅ Change prompts without touching code
  • ✅ Version prompts with git
  • ✅ Test prompts with real data
  • ✅ Track which version is in production

What Grompt Is

1. Prompt Storage

  • Prompts live in YAML files (prompts/code-review.yaml)
  • Not buried in code
  • Easy to edit, review, and share

2. Versioning

  • Track changes with version numbers
  • Commit changes: grompt commit code-review
  • Only version when content actually changes (hash-based)

3. Use in Code

import grompt
prompt = grompt.load("code-review")
result = prompt.render(code="...", language="Python")

What Grompt Is NOT

  • ❌ Not a test runner - Use pytest for that
  • ❌ Not an LLM execution engine - Just manages prompts
  • ❌ Not a prompt optimization tool - Just stores and versions them
  • ❌ Not a database - Just files

Installation

Install Grompt via pip:

pip install grompt

For development installation:

pip install -e ".[dev]"

Quick Start

The Simple Workflow

1. Create prompt file    → prompts/code-review.yaml
2. Edit it               → vim prompts/code-review.yaml
3. Test it               → Use test inputs or pytest
4. Commit changes        → grompt commit code-review
5. Use in code          → grompt.load("code-review")

Step-by-Step

1. Initialize Grompt

Initialize Grompt in your project root. This creates a .grompt config file and a prompts directory.

grompt init

2. Create a Prompt

Create a new prompt named code-review.

grompt add code-review --template "Review this code:\n{{ code }}"

This creates prompts/code-review.yaml.

3. Use in Python

Load and use the prompt in your application.

import grompt

# Load the prompt
prompt = grompt.load("code-review")

# Render with variables
rendered = prompt.render(
    code="def add(a,b): return a+b"
)
print(rendered)

4. Load Variables from Files (Optional)

Use the optional helper to load test inputs from YAML files:

import grompt

prompt = grompt.load("code-review")

# Load variables from any YAML file
variables = grompt.load_variables("inputs/simple.yaml")
result = prompt.render(**variables)

5. Commit Changes

Commit changes when you're ready:

grompt commit code-review "Updated template"

File Structure

my-project/
├── prompts/
│   ├── code-review.yaml              ← Your prompts
│   └── test-inputs/                  ← Example inputs (optional)
│       └── code-review.simple.yaml
└── .grompt/                          ← Config (auto-created)
    └── config.yaml

Just files. Nothing hidden.


Quick Reference

Create Prompt

grompt add code-review

Edit Prompt

vim prompts/code-review.yaml

Test with Input

# Create input file (anywhere, any name)
cat > inputs/simple.yaml << EOF
code: "def add(a, b): return a + b"
language: Python
EOF

# Use in Python
python3 << EOF
import grompt

prompt = grompt.load("code-review")
inputs = grompt.load_variables("inputs/simple.yaml")  # Any path
result = prompt.render(**inputs)
print(result)
EOF

Commit Changes

grompt commit code-review "Updated template"

Use in Code

import grompt
prompt = grompt.load("code-review")
result = prompt.render(code="...", language="Python")

Documentation


Contributing

We welcome contributions! Please see:


Security

For security concerns, please see SECURITY.md.

Please do not report security vulnerabilities through public GitHub issues. Instead, email: mkarots@users.noreply.github.com


License

MIT

Metadata

Release files for grompt 0.3.1

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

Source distribution (sdist)

Source distribution for grompt 0.3.1
File Size Uploaded Provenance Actions
grompt-0.3.1.tar.gz 15.8 kB Without provenance Details for grompt-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 33.5 kB

Release files / grompt-0.3.1.tar.gz

Download URL grompt-0.3.1.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
623fdfdd1b24957d88fa22d3e12b51a61eb4a90ec4d733b7e410a325d3907462
BLAKE2b-256 checksum
How to use checksums
77b7bf76ad6157e9a691ff716cbde2c76fef190b63a9c14a5071c7c2c181fa24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / grompt-0.3.1-py3-none-any.whl

Download URL grompt-0.3.1-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d8f8bc696817c87805ec19d7c31e3b424f8531f921736cd9dee245b4a860d49
BLAKE2b-256 checksum
How to use checksums
204e4441b565c10a3963980496a30bf7e81e975237e48b57e78165d6e9c755e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for grompt 0.3.1

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.

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