> built 2026-11-23 07:13 UTC from 68ddc38 (main) · pyrompt 0.0.14. Details: build_info.json

# index.html.md

<!-- generated by epythet -->

# pyrompt: Python Prompt Management

> A flexible framework for managing, sharing, and searching prompts and prompt templates with support for multiple templating languages and idiomatic Python interfaces.

## Overview

**pyrompt** makes it easy to:

- 📝 Manage collections of prompts and templates with dict-like interfaces
- 🎨 Use multiple template formats (Jinja2, Mustache, Python format strings, etc.)
- 🔌 Extend with custom template languages via plugin system
- 🔍 Search prompts semantically using embeddings
- 🌐 Share and discover prompt collections via GitHub
- 🎯 Create AI-enabled functions from templates using `oa.prompt_function`
- 💾 Store prompts locally, on GitHub, or custom backends
- 🏗️ Build composable prompt management systems

All data sources use Python’s `Mapping` and `MutableMapping` interfaces (via `dol`), and all template types are registered in an extensible plugin system.

## What pyrompt adds

Hosted prompt servers such as [Langfuse](https://github.com/langfuse/langfuse) give you numbered prompt versions, labels and a UI, at the cost of running (or paying for) a service. File formats such as [Prompty](https://github.com/microsoft/prompty) define one prompt per `.prompty` file and a runner for it. pyrompt is neither: it is a dict-like layer over *any* store (a folder, a GitHub repo, any `dol` backend), with a choice of template engines, embedding search across a collection, and GitHub sharing. Versioning comes from the store (for example git), not from pyrompt.

If you need to read `.prompty` files, the route is a `TemplateEngine` registered for the `.prompty` extension; none ships yet.

## Quick Start

```python
from pyrompt import PromptCollection, TemplateCollection

# Create collections
prompts = PromptCollection("my_project")
templates = TemplateCollection("my_project")

# Store a simple prompt
prompts["system"] = "You are a helpful Python expert."

# Store templates (default: Python format strings)
templates["greeting"] = "Hello, {name}! Welcome to {place}."

# Use template with format syntax
print(templates["greeting"].format(name="Alice", place="Wonderland"))
# Output: Hello, Alice! Welcome to Wonderland.

# Create an AI function from a template
from aix import prompt_func

greet = prompt_func(templates["greeting"])
response = greet(name="Bob", place="the future")
```

## Installation

```bash
# Basic installation (Python format strings, Jinja2 templates)
pip install pyrompt

# With AI functions (generation is routed through aix)
pip install pyrompt[ai]
```

**Dependencies:**

- `dol` - Storage abstractions (Mapping/MutableMapping interfaces)
- `aix` (optional, the `ai` extra) - LLM generation (`aix.prompt_func`)
- `oa` (optional) - embeddings for semantic search
- `i2` - Function signature manipulation and wrapping
- `jinja2` (optional) - Jinja2 templating support
- `pystache` (optional) - Mustache templating support
- `imbed` (optional) - Advanced semantic search

## Template Languages

pyrompt supports multiple template formats with an extensible plugin system. Choose the right tool for your needs:

### Default: Python Format Strings

Simple and built-in, perfect for basic substitution:

```python
templates["basic"] = "Hello, {name}! You are {age} years old."
```

**Pros:** Native Python, no dependencies, simple
**Cons:** No conditionals, no loops, no default values in template

### Jinja2 (Recommended for Complex Prompts)

Rich templating with conditionals, loops, and filters:

```python
templates["advanced.jinja2"] = """
Hello, {{ name|default('friend') }}!

{% if role %}
You are logged in as: {{ role }}
{% else %}
You are browsing as a guest.
{% endif %}

{% if items %}
Your items:
{% for item in items %}
  - {{ item }}
{% endfor %}
{% endif %}
"""

# Use with Jinja2 engine
from pyrompt.engines import Jinja2Engine

result = templates.render(
    "advanced.jinja2", name="Alice", role="admin", items=["prompt1", "prompt2"]
)
```

**Pros:** Powerful, widely used, great for complex prompts
**Cons:** Requires jinja2 dependency, more complex syntax

### Mustache (Logic-less Templates)

Cross-platform, simple conditional sections:

```python
templates["mustache.mustache"] = """
Hello {{name}}!

{{#premium}}
Thank you for being a premium member!
{{/premium}}

{{^premium}}
Consider upgrading to premium.
{{/premium}}

{{#features}}
- {{.}}
{{/features}}
"""

# Mustache automatically handles sections and loops
result = templates.render(
    "mustache.mustache", name="Bob", premium=True, features=["feature1", "feature2"]
)
```

**Pros:** Simple, logic-less, cross-language standard
**Cons:** Limited power, requires pystache dependency

### Template Auto-Detection

pyrompt automatically detects template types by extension:

```python
# These are automatically parsed with the right engine:
templates["simple.txt"] = "Hello {name}"  # Python format
templates["complex.jinja2"] = "Hello {{ name }}"  # Jinja2
templates["logic.mustache"] = "Hello {{name}}"  # Mustache

# Sub-extensions also work:
templates["code.jinja2.txt"] = "..."  # Detected as Jinja2
templates["data.mustache.md"] = "..."  # Detected as Mustache
```

## Core Concepts

### Collections with Metadata

```python
from pyrompt import PromptCollection

prompts = PromptCollection("my_project", with_metadata=True)

# Store a prompt
prompts["data_analyst"] = "You are an expert data analyst specializing in Python."

# Add metadata
prompts.meta["data_analyst"] = {
    "author": "thor",
    "version": "1.0",
    "tags": ["system", "data", "python"],
    "template_engine": "format",  # or 'jinja2', 'mustache', etc.
    "created": "2025-11-12",
    "description": "System prompt for data analysis tasks",
}
```

### Creating AI Functions

Transform templates into callable AI functions:

```python
from pyrompt import TemplateCollection
from aix import prompt_func

templates = TemplateCollection("my_project")

# Simple prompt function
templates["code_review"] = """
Review this {language} code:

{code}

Focus on: {focus_areas}
"""

review_code = prompt_func(templates["code_review"])

result = review_code(
    language="python",
    code='def hello(): return "world"',
    focus_areas="correctness and readability",
)

# JSON-returning function
templates["extract_entities"] = """
Extract entities from this text: {text}

Return a JSON object with keys: people, places, organizations
"""

extract = templates.to_prompt_json_function(
    "extract_entities",
    json_schema={
        "name": "entities",
        "schema": {
            "type": "object",
            "properties": {
                "people": {"type": "array", "items": {"type": "string"}},
                "places": {"type": "array", "items": {"type": "string"}},
                "organizations": {"type": "array", "items": {"type": "string"}},
            },
        },
    },
)

entities = extract(text="Alice works at Google in New York.")
# Returns: {"people": ["Alice"], "places": ["New York"], "organizations": ["Google"]}
```

### Using PromptFuncs for Collections

```python
from oa import PromptFuncs

# Create a collection of AI-enabled functions
funcs = PromptFuncs(
    template_store=templates,
    # Automatically creates functions for all templates
)

# Or from a dict
funcs = PromptFuncs(
    template_store={
        "haiku": "Write a haiku about {subject}. Only output the haiku.",
        "summarize": "Summarize this in {n_words} words: {text}",
    }
)

# Use them
print(funcs.haiku(subject="Python"))
print(funcs.summarize(text="Long text...", n_words="50"))
```

## Storage Locations

Default storage:

- **macOS/Linux**: `~/.local/share/pyrompt/collections/{collection_name}/`
- **Windows**: `%LOCALAPPDATA%/pyrompt/collections/{collection_name}/`

Structure:

```default
my_project/
├── prompts/                    # Simple prompts
├── templates/                  # Templates (auto-detected by extension)
│   ├── simple.txt             # Python format
│   ├── advanced.jinja2        # Jinja2
│   └── logic.mustache         # Mustache
├── _prompt_meta/              # JSON metadata
└── _template_meta/            # JSON metadata
```

## Custom Storage Location

```python
from pyrompt import PromptCollection

# Use a specific directory
prompts = PromptCollection("my_project", base_path="/custom/path")

# Or environment variable
import os

os.environ["PYROMPT_DATA_DIR"] = "/my/prompts"
prompts = PromptCollection("my_project")
```

## GitHub Integration

### Publishing Your Collection

```python
from pyrompt import GitHubPromptCollection

gh_prompts = GitHubPromptCollection(
    repo="username/my_project_pyrompt",  # Must end with '_pyrompt'
    token="your_github_token",
)

gh_prompts["sql_expert"] = "You are an expert in SQL optimization."
gh_prompts.sync()  # Commits and pushes
```

### Discovering Collections

```python
from pyrompt import discover_prompt_collections

collections = discover_prompt_collections(search_term="python data", min_stars=10)

for repo in collections:
    print(f"{repo['name']}: {repo['description']}")
```

## Semantic Search

Build semantic indices for intelligent discovery:

```python
from pyrompt import PromptCollection, SemanticIndex

prompts = PromptCollection("my_project")

# Add prompts
prompts["python_expert"] = "You are a Python programming expert."
prompts["data_viz"] = "You specialize in data visualizations."
prompts["ml_engineer"] = "You are a machine learning engineer."

# Build semantic index (uses oa.embeddings)
index = SemanticIndex(prompts)

# Search semantically
results = index.search("help with pandas dataframes", top_k=3)
for name, score in results:
    print(f"{name} (score: {score:.3f})")
```

### Batch Embeddings

For large collections:

```python
from oa.batch_embeddings import compute_embeddings

prompt_keys = list(prompts.keys())
prompt_texts = [prompts[k] for k in prompt_keys]

# Compute in batches (uses OpenAI batch API)
result_texts, embeddings = compute_embeddings(
    segments=prompt_texts, batch_size=100, verbosity=1
)

# Store embeddings
for key, embedding in zip(prompt_keys, embeddings):
    prompts.embeddings[key] = embedding
```

## Extending with Custom Template Engines

Register your own template engines:

```python
from pyrompt.engines import TemplateEngine, register_engine


class MyCustomEngine(TemplateEngine):
    """Custom template engine"""

    name = "custom"
    extensions = [".custom", ".cust"]

    def parse_template(self, template_str: str) -> dict:
        """Extract placeholders and defaults"""
        # Your parsing logic
        return {"placeholders": ["name", "value"], "defaults": {"value": "42"}}

    def render(self, template_str: str, **kwargs) -> str:
        """Render template with values"""
        # Your rendering logic
        return template_str  # simplified

    def detect(self, content: str) -> bool:
        """Detect if content uses this engine"""
        return "<<" in content and ">>" in content


# Register it
register_engine(MyCustomEngine())

# Now use it
templates["my_template.custom"] = "Hello <<name>>, value is <<value>>"
```

## Collection of Collections (Malls)

Organize multiple collections:

```python
from pyrompt import PromptMall

mall = PromptMall("my_workspace")

# Access different collections
mall["system_prompts"]["python_expert"] = "You are a Python expert."
mall["templates"]["code_review"] = "Review this {language} code..."
mall["personas"]["analyst"] = "You are a data analyst..."

# List collections
list(mall.keys())  # ['system_prompts', 'templates', 'personas']

# Search across collections
results = mall.search("python", collections=["system_prompts", "personas"])
```

## Real-World Example

```python
from pyrompt import PromptCollection, TemplateCollection
from aix import prompt_func

# Set up collections
system_prompts = PromptCollection("system")
templates = TemplateCollection("templates")

# System prompts
system_prompts["code_reviewer"] = """You are an expert code reviewer.
Focus on: correctness, efficiency, readability, and best practices."""

# Jinja2 template with conditionals
templates["review_pr.jinja2"] = """
Review this pull request:

**Title**: {{ pr_title }}
**Description**: {{ pr_description }}

{% if changed_files %}
**Changed Files**:
{{ changed_files }}
{% endif %}

Provide:
1. Summary of changes
2. Potential issues
{% if include_suggestions %}
3. Suggestions for improvement
{% endif %}
"""

# Create AI function
review_pr = prompt_func(
    templates["review_pr.jinja2"],
    prompt_func_kwargs={"system": system_prompts["code_reviewer"]},
)

# Use it
result = review_pr(
    pr_title="Add new feature",
    pr_description="Implements user authentication",
    changed_files="auth.py, models.py",
    include_suggestions=True,
)
```

## Template Format Comparison

| Feature      | Format             | Jinja2            | Mustache           |
|--------------|--------------------|-------------------|--------------------|
| Syntax       | `{var}`            | `{{ var }}`       | `{{var}}`          |
| Conditionals | No                 | Yes (`{% if %}`)  | Yes (`{{#var}}`)   |
| Loops        | No                 | Yes (`{% for %}`) | Yes (`{{#array}}`) |
| Defaults     | No                 | Yes (`|default`)  | Via sections       |
| Filters      | No                 | Yes               | No                 |
| Dependencies | None               | jinja2            | pystache           |
| Complexity   | Simple             | Medium            | Simple             |
| Best For     | Basic substitution | Complex prompts   | Cross-platform     |

**Recommendation:** Start with Python format strings for simple prompts. Graduate to Jinja2 when you need conditionals, loops, or default values. Use Mustache if you need cross-language compatibility.

## Architecture Principles

Following `i2mint` philosophy, `pyrompt`:

1. **Facades everything**: Storage via `dol.Mapping`/`MutableMapping`, templates via unified interface
2. **Plugin system**: Register new template engines without modifying core
3. **Composable**: Build complex workflows from simple components
4. **Type-hinted**: Full type coverage for IDE support
5. **Zero magic**: Explicit interfaces, clear abstractions
6. **Open-closed**: Extend functionality without changing existing code

## Implementation Stack

**Core dependencies:**

- `dol`: Storage abstractions and key-value transformations
  - `dol.Files`, `dol.wrap_kvs`, `dol.filt_iter`, `dol.KeyCodecs`
- `i2`: Function manipulation and signature handling
  - `i2.Sig`, `i2.Wrapper`, `i2.signatures`
- `oa`: AI operations
  - `oa.prompt_function`, `oa.prompt_json_function`
  - `oa.embeddings`, `oa.PromptFuncs`

**Optional integrations:**

- `imbed`: Semantic search and clustering
- `jinja2`: Advanced templating
- `pystache`: Mustache templates

## CLI Usage (Planned)

```bash
# Create a new collection
pyrompt new my_project

# Add a prompt
pyrompt add my_project/greeting "Hello, {name}!"

# List templates
pyrompt list my_project --templates

# Test a template
pyrompt render my_project/greeting.jinja2 --name Alice

# Search prompts
pyrompt search my_project "help with databases"

# Sync to GitHub
pyrompt sync my_project --repo username/my_project_pyrompt

# Discover collections
pyrompt discover --search "python" --min-stars 10
```

## Contributing

We welcome contributions! Priority areas:

- Additional template engines (Handlebars, Guidance DSL, etc.)
- Enhanced semantic search algorithms
- Prompt optimization tools
- Template testing utilities
- Collection templates for common use cases

See `IMPLEMENTATION_PLAN.md` for development roadmap.

## License

MIT License - See LICENSE file for details

---

**Key Features:**

- 🎨 Multiple template formats (Format, Jinja2, Mustache, extensible)
- 🔌 Plugin architecture for custom engines
- 🤖 Direct integration with `oa.prompt_function` and `oa.prompt_json_function`
- 📦 Clean storage via `dol` abstractions
- 🔍 Semantic search with `oa.embeddings`
- 🌐 GitHub sharing and discovery
- 🏗️ Built on `i2mint` principles: facades, composition, extensibility

<p class="epythet-aggregates">This documentation as a single file: <a href="pyrompt.md">pyrompt.md</a> (Markdown, for agents).</p>


# _autosummary/pyrompt.base.html.md

# pyrompt.base

Core collection classes for prompts and templates.

Provides PromptCollection and TemplateCollection with MutableMapping interfaces.

### Classes

| [`PromptCollection`](_autosummary/pyrompt.base.html.md#pyrompt.base.PromptCollection)(collection_name, \*[, ...])   | Collection of prompts with MutableMapping interface.   |
|-------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| [`TemplateCollection`](_autosummary/pyrompt.base.html.md#pyrompt.base.TemplateCollection)(collection_name, \*[, ...]) | Collection of templates with multi-engine support.     |

### *class* pyrompt.base.PromptCollection(collection_name, , base_path=None, with_metadata=False, store_factory=None)

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Collection of prompts with MutableMapping interface.

Backed by file storage via dol, with optional metadata.

### Examples

```pycon
>>> import tempfile
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> prompts['system'] = "You are a helpful assistant."
>>> print(prompts['system'])
You are a helpful assistant.
>>> len(prompts)
1
```

### *class* pyrompt.base.TemplateCollection(collection_name, , base_path=None, with_metadata=False, default_engine='format')

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Collection of templates with multi-engine support.

Automatically detects template engine based on file extension
or content. Provides rendering capabilities.

### Examples

```pycon
>>> import tempfile
>>> templates = TemplateCollection('my_project', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> templates.render('greeting.txt', name='Alice')
'Hello Alice!'
>>> # With Jinja2 (if installed)
>>> templates['greeting.jinja2'] = "Hello {{ name }}!"
>>> templates.render('greeting.jinja2', name='Bob')
'Hello Bob!'
```

#### create_prompt_functions(keys=None, \*\*common_kwargs)

Create an `aix.PromptFuncs` collection from templates (one function per key).

LLM generation routes through `aix` (lazy import).

* **Parameters:**
  * **keys** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Template keys to include (None = all)
  * **\*\*common_kwargs** – Common kwargs for all prompt functions (e.g. ‘model’)
* **Returns:**
  `aix.PromptFuncs` object with a function for each template

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['greeting.txt'] = "Greet {name}"
>>> funcs = tc.create_prompt_functions()
>>> funcs['greeting.txt'](name='Alice')
'Hello Alice!'
```

#### parse(key)

Parse a template to extract structure.

Returns dict with placeholders, defaults, metadata.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)
* **Returns:**
  Dict with ‘placeholders’, ‘defaults’, ‘metadata’

### Example

```pycon
>>> import tempfile
>>> templates = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> info = templates.parse('greeting.txt')
>>> info['placeholders']
['name']
```

#### render(key, \*\*kwargs)

Render a template with provided values.

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered template string

### Example

```pycon
>>> import tempfile
>>> templates = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> templates.render('greeting.txt', name='Alice')
'Hello Alice!'
```

#### to_prompt_function(key, \*\*prompt_func_kwargs)

Convert template to an AI-enabled function using `aix.prompt_func`.

LLM generation is routed through `aix` (the multi-provider facade) so the
model/provider is switchable. `aix` is imported lazily, only when called.

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **\*\*prompt_func_kwargs** – Additional kwargs for `aix.prompt_func`
    (e.g., ‘model’, ‘temperature’, ‘name’)
* **Returns:**
  Callable function that invokes the LLM with the rendered template

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['explain.txt'] = "Explain {concept} in simple terms."
>>> explain = tc.to_prompt_function('explain.txt')
>>> explain(concept="quantum computing")
'Quantum computing is ...'
```

#### to_prompt_json_function(key, json_schema, \*\*prompt_func_kwargs)

Convert template to a JSON-returning AI function.

Uses `aix.prompt_func(output_schema=dict)`: aix requests JSON and parses it
robustly (tolerating fenced output), returning a parsed dict. `json_schema` is
accepted for API compatibility; aix does best-effort JSON rather than strict
JSON-Schema enforcement. LLM generation routes through `aix` (lazy import).

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **json_schema** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Desired JSON schema (kept for API compatibility)
  * **\*\*prompt_func_kwargs** – Additional kwargs for `aix.prompt_func`
* **Returns:**
  Function that returns a parsed JSON dict

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['extract.txt'] = "Extract people from: {text}"
>>> extract = tc.to_prompt_json_function('extract.txt', {})
>>> extract(text="Alice met Bob")
{'people': ['Alice', 'Bob']}
```


# _autosummary/pyrompt.cli.html.md

# pyrompt.cli

Command-line interface for pyrompt.

Simple CLI for managing prompt collections.

### Functions

| [`cmd_add`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_add)(args)     | Add a prompt to a collection.    |
|--------------------------------------------------------------------|----------------------------------|
| [`cmd_engines`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_engines)(args) | List available template engines. |
| [`cmd_list`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_list)(args)    | List prompts in a collection.    |
| [`cmd_new`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_new)(args)     | Create a new collection.         |
| [`cmd_render`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_render)(args)  | Render a template.               |
| [`cmd_show`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_show)(args)    | Show a specific prompt.          |
| [`cmd_stats`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.cmd_stats)(args)   | Show collection statistics.      |
| [`main`](_autosummary/pyrompt.cli.html.md#pyrompt.cli.main)()            | Main CLI entry point.            |

### pyrompt.cli.cmd_add(args)

Add a prompt to a collection.

### pyrompt.cli.cmd_engines(args)

List available template engines.

### pyrompt.cli.cmd_list(args)

List prompts in a collection.

### pyrompt.cli.cmd_new(args)

Create a new collection.

### pyrompt.cli.cmd_render(args)

Render a template.

### pyrompt.cli.cmd_show(args)

Show a specific prompt.

### pyrompt.cli.cmd_stats(args)

Show collection statistics.

### pyrompt.cli.main()

Main CLI entry point.


# _autosummary/pyrompt.engines.format_engine.html.md

# pyrompt.engines.format_engine

Python format string template engine.

Supports standard Python format strings with {placeholder} syntax.
Provides extended syntax for defaults: {name:default_value}

### Classes

| [`FormatEngine`](_autosummary/pyrompt.engines.format_engine.html.md#pyrompt.engines.format_engine.FormatEngine)()   | Python format string engine.   |
|-------------------------------------------------------------------|--------------------------------|

### *class* pyrompt.engines.format_engine.FormatEngine

Bases: [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)

Python format string engine.

Syntax: {name} or {name:format_spec}
Extended: {name:default_value} for simple defaults (when not a format spec)

### Examples

```pycon
>>> engine = FormatEngine()
>>> engine.render("Hello {name}!", name="Alice")
'Hello Alice!'
>>> info = engine.parse_template("Hello {name}, you are {age} years old!")
>>> info['placeholders']
['name', 'age']
```

#### detect(content)

Detect format strings by single braces.

* **Parameters:**
  **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)
* **Returns:**
  True if content appears to use Python format syntax

#### parse_template(template_str)

Extract placeholders from format string.

Uses string.Formatter to parse the template.

* **Parameters:**
  **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)
* **Returns:**
  dict with ‘placeholders’, ‘defaults’, ‘metadata’

#### render(template_str, \*\*kwargs)

Render using str.format().

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string


# _autosummary/pyrompt.engines.html.md

# pyrompt.engines

Template engine plugin system for pyrompt.

Provides extensible template engine support with auto-detection.

### Functions

| [`register_engine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.register_engine)(engine)             | Register a template engine.                |
|--------------------------------------------------------------------------------------|--------------------------------------------|
| [`get_engine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.get_engine)(name)                    | Get engine by name.                        |
| [`get_engine_by_extension`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.get_engine_by_extension)(extension)  | Get engine that handles a given extension. |
| [`detect_engine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.detect_engine)(content[, extension]) | Detect appropriate engine for content.     |
| [`list_engines`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.list_engines)()                      | List all registered engine names.          |

### Classes

| [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)()   | Abstract base class for template engines.   |
|---------------------------------------------------------------------|---------------------------------------------|

### *class* pyrompt.engines.TemplateEngine

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

Abstract base class for template engines.

Template engines parse and render templates with different syntaxes.
They must provide:

- name: Unique identifier (e.g., ‘format’, ‘jinja2’)
- extensions: List of file extensions (e.g., [‘.jinja2’, ‘.j2’])
- parse_template: Extract placeholders and defaults
- render: Render template with values
- detect: Optionally detect if content uses this engine

#### detect(content)

Detect if content uses this engine based on syntax.

Used when extension doesn’t clearly indicate engine.
Override to provide content-based detection.

* **Parameters:**
  **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)
* **Returns:**
  True if content appears to use this engine

#### *abstractmethod* parse_template(template_str)

Parse template to extract structure.

* **Parameters:**
  **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Returns:**
  - ‘placeholders’: list of parameter names
  - ’defaults’: dict of default values
  - ’metadata’: any engine-specific info
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

#### *abstractmethod* render(template_str, \*\*kwargs)

Render template with provided values.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string

### pyrompt.engines.detect_engine(content, extension=None)

Detect appropriate engine for content.

Priority:

1. Extension match (if provided)
2. Content-based detection
3. Default (format)

* **Parameters:**
  * **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **extension** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Optional file extension
* **Return type:**
  [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)
* **Returns:**
  TemplateEngine instance (never None, falls back to ‘format’)

### pyrompt.engines.get_engine(name)

Get engine by name.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Engine name (e.g., ‘format’, ‘jinja2’)
* **Return type:**
  [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)]
* **Returns:**
  TemplateEngine instance or None if not found

### pyrompt.engines.get_engine_by_extension(extension)

Get engine that handles a given extension.

* **Parameters:**
  **extension** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – File extension (e.g., ‘.jinja2’)
* **Return type:**
  [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)]
* **Returns:**
  TemplateEngine instance or None if not found

### pyrompt.engines.list_engines()

List all registered engine names.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]
* **Returns:**
  List of engine names

### pyrompt.engines.register_engine(engine)

Register a template engine.

* **Parameters:**
  **engine** ([`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)) – TemplateEngine instance to register

### Modules

| [`format_engine`](_autosummary/pyrompt.engines.format_engine.html.md#module-pyrompt.engines.format_engine)     | Python format string template engine.   |
|---------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [`jinja2_engine`](_autosummary/pyrompt.engines.jinja2_engine.html.md#module-pyrompt.engines.jinja2_engine)     | Jinja2 template engine.                 |
| [`mustache_engine`](_autosummary/pyrompt.engines.mustache_engine.html.md#module-pyrompt.engines.mustache_engine) | Mustache template engine.               |


# _autosummary/pyrompt.engines.jinja2_engine.html.md

# pyrompt.engines.jinja2_engine

Jinja2 template engine.

Provides rich templating with conditionals, loops, and filters.

### Classes

| [`Jinja2Engine`](_autosummary/pyrompt.engines.jinja2_engine.html.md#pyrompt.engines.jinja2_engine.Jinja2Engine)()   | Jinja2 template engine.   |
|-------------------------------------------------------------------|---------------------------|

### *class* pyrompt.engines.jinja2_engine.Jinja2Engine

Bases: [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)

Jinja2 template engine.

Syntax: {{ variable }}, {% if %}, {% for %}, etc.
Supports filters: {{ name|default(‘friend’) }}

### Examples

```pycon
>>> # Requires jinja2 installed
>>> engine = Jinja2Engine()
>>> template = "Hello {{ name|default('friend') }}!"
>>> engine.render(template, name="Alice")
'Hello Alice!'
>>> engine.render(template)
'Hello friend!'
```

#### detect(content)

Detect Jinja2 by {{ }} and {% %}.

* **Parameters:**
  **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)
* **Returns:**
  True if content appears to use Jinja2 syntax

#### parse_template(template_str)

Parse Jinja2 template to extract variables.

Uses Jinja2’s meta.find_undeclared_variables().

* **Parameters:**
  **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)
* **Returns:**
  dict with ‘placeholders’, ‘defaults’, ‘metadata’

#### render(template_str, \*\*kwargs)

Render Jinja2 template.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string
* **Raises:**
  **jinja2.TemplateError** – If template has errors


# _autosummary/pyrompt.engines.mustache_engine.html.md

# pyrompt.engines.mustache_engine

Mustache template engine.

Logic-less templates with sections and partials.

### Classes

| [`MustacheEngine`](_autosummary/pyrompt.engines.mustache_engine.html.md#pyrompt.engines.mustache_engine.MustacheEngine)()   | Mustache template engine.   |
|---------------------------------------------------------------------|-----------------------------|

### *class* pyrompt.engines.mustache_engine.MustacheEngine

Bases: [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)

Mustache template engine.

Syntax: {{variable}}, {{#section}}, {{^inverted}}, {{!comment}}
Logic-less templating for cross-platform compatibility.

### Examples

```pycon
>>> # Requires pystache installed
>>> engine = MustacheEngine()
>>> template = "Hello {{name}}!"
>>> engine.render(template, name="Alice")
'Hello Alice!'
>>> template = "{{#premium}}Thank you!{{/premium}}"
>>> engine.render(template, premium=True)
'Thank you!'
```

#### detect(content)

Detect Mustache by {{var}} without spaces.

Distinguishes from Jinja2 by lack of spaces: {{var}} vs {{ var }}.

* **Parameters:**
  **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)
* **Returns:**
  True if content appears to use Mustache syntax

#### parse_template(template_str)

Parse Mustache template for variables.

Extracts variable names from {{var}} and {{#section}} tags.

* **Parameters:**
  **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)
* **Returns:**
  dict with ‘placeholders’, ‘defaults’, ‘metadata’

#### render(template_str, \*\*kwargs)

Render Mustache template.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string


# _autosummary/pyrompt.github_integration.html.md

# pyrompt.github_integration

GitHub integration for sharing and discovering prompt collections.

Enables:

- Publishing collections to GitHub repositories
- Discovering public collections
- Syncing collections with GitHub

### Functions

| [`clone_collection`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.clone_collection)(repo, local_path[, token])     | Clone a GitHub collection to local directory.      |
|--------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [`discover_prompt_collections`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.discover_prompt_collections)([search_term, ...]) | Discover public \*_pyrompt repositories on GitHub. |
| [`fork_collection`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.fork_collection)(source, token[, organization])  | Fork a collection to your account or organization. |

### Classes

| [`GitHubPromptCollection`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.GitHubPromptCollection)(repo, \*[, token, ...])   | Prompt collection backed by GitHub repository.   |
|---------------------------------------------------------------------------------------------------|--------------------------------------------------|

### *class* pyrompt.github_integration.GitHubPromptCollection(repo, , token=None, readonly=True, branch='main', local_cache=None, collection_type='prompts')

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Prompt collection backed by GitHub repository.

Repositories must end with ‘_pyrompt’ suffix for discovery.
Contains prompts/ and/or templates/ directories.

### Examples

```pycon
>>> # Publishing a collection
>>> gh = GitHubPromptCollection(
...     repo='username/my_prompts_pyrompt',
...     token='ghp_...',
...     readonly=False
... )
>>> gh['greeting'] = "Hello, {name}!"
>>> gh.sync()  # Commits and pushes to GitHub
```

#### sync(message='Update prompts via pyrompt')

Push local changes to GitHub.

* **Parameters:**
  **message** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Commit message
* **Raises:**
  [**PermissionError**](https://docs.python.org/3/builtins/exceptions.html#PermissionError) – If collection is readonly

### pyrompt.github_integration.clone_collection(repo, local_path, token=None)

Clone a GitHub collection to local directory.

* **Parameters:**
  * **repo** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Repository name (user/repo_pyrompt)
  * **local_path** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Local directory path
  * **token** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional GitHub token

### Example

```pycon
>>> clone_collection(
...     'thorwhalen/awesome_prompts_pyrompt',
...     '/tmp/my_prompts'
... )
```

### pyrompt.github_integration.discover_prompt_collections(search_term=None, min_stars=0, language='Python', max_results=50)

Discover public \*_pyrompt repositories on GitHub.

* **Parameters:**
  * **search_term** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Search query (e.g., “python data”)
  * **min_stars** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Minimum star count
  * **language** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Programming language filter
  * **max_results** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Maximum number of results
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]
* **Returns:**
  List of dicts with repo info (name, description, stars, url)

### Example

```pycon
>>> collections = discover_prompt_collections(
...     search_term='python',
...     min_stars=5
... )
>>> for repo in collections:
...     print(f"{repo['name']}: {repo['stars']} stars")
```

### pyrompt.github_integration.fork_collection(source, token, organization=None)

Fork a collection to your account or organization.

* **Parameters:**
  * **source** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Source repo (user/repo_pyrompt)
  * **token** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – GitHub token with repo permissions
  * **organization** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional organization to fork to
* **Return type:**
  [`GitHubPromptCollection`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.GitHubPromptCollection)
* **Returns:**
  GitHubPromptCollection for the new fork

### Example

```pycon
>>> forked = fork_collection(
...     'thorwhalen/awesome_prompts_pyrompt',
...     token='ghp_...'
... )
```


# _autosummary/pyrompt.html.md

# pyrompt

pyrompt: Python Prompt Management

A flexible framework for managing, sharing, and searching prompts and prompt templates
with support for multiple templating languages and idiomatic Python interfaces.

Quick Start:

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection, TemplateCollection
>>> _base = tempfile.mkdtemp()
>>> prompts = PromptCollection('my_project', base_path=_base)
>>> templates = TemplateCollection('my_project', base_path=_base)
>>> prompts['system'] = "You are a helpful Python expert."
>>> templates['greeting.txt'] = "Hello, {name}!"
>>> print(templates.render('greeting.txt', name='Alice'))
Hello, Alice!
```

Main Components:

> - PromptCollection: Store and manage prompts
> - TemplateCollection: Store and manage templates with multi-engine support
> - PromptMall: Collection of collections
> - SemanticIndex: Semantic search over prompts
> - GitHubPromptCollection: GitHub-backed collections

### Functions

| [`register_engine`](_autosummary/pyrompt.html.md#pyrompt.register_engine)(engine)                           | Register a template engine.                                |
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [`get_engine`](_autosummary/pyrompt.html.md#pyrompt.get_engine)(name)                                  | Get engine by name.                                        |
| [`list_engines`](_autosummary/pyrompt.html.md#pyrompt.list_engines)()                                    | List all registered engine names.                          |
| [`detect_engine`](_autosummary/pyrompt.html.md#pyrompt.detect_engine)(content[, extension])               | Detect appropriate engine for content.                     |
| [`discover_prompt_collections`](_autosummary/pyrompt.html.md#pyrompt.discover_prompt_collections)([search_term, ...])   | Discover public \*_pyrompt repositories on GitHub.         |
| [`fork_collection`](_autosummary/pyrompt.html.md#pyrompt.fork_collection)(source, token[, organization])    | Fork a collection to your account or organization.         |
| [`clone_collection`](_autosummary/pyrompt.html.md#pyrompt.clone_collection)(repo, local_path[, token])       | Clone a GitHub collection to local directory.              |
| [`get_default_base_path`](_autosummary/pyrompt.html.md#pyrompt.get_default_base_path)()                           | Get platform-appropriate base path for pyrompt data.       |
| [`quick_setup`](_autosummary/pyrompt.html.md#pyrompt.quick_setup)(project_name[, with_templates, ...])  | Quick setup for a new pyrompt project.                     |
| [`import_from_dict`](_autosummary/pyrompt.html.md#pyrompt.import_from_dict)(collection, prompts[, metadata]) | Import prompts from a dictionary.                          |
| [`export_to_dict`](_autosummary/pyrompt.html.md#pyrompt.export_to_dict)(collection[, include_metadata])    | Export collection to a dictionary.                         |
| [`validate_template`](_autosummary/pyrompt.html.md#pyrompt.validate_template)(template_str[, ...])            | Validate a template string.                                |
| [`merge_collections`](_autosummary/pyrompt.html.md#pyrompt.merge_collections)(target, \*sources[, ...])       | Merge multiple collections into a target collection.       |
| [`list_available_engines`](_autosummary/pyrompt.html.md#pyrompt.list_available_engines)()                          | List all available template engines with their details.    |
| [`render_template_file`](_autosummary/pyrompt.html.md#pyrompt.render_template_file)(file_path[, output_path])    | Render a template file directly.                           |
| [`create_project_structure`](_autosummary/pyrompt.html.md#pyrompt.create_project_structure)(project_name[, ...])     | Create a complete project structure for prompt management. |
| [`get_stats`](_autosummary/pyrompt.html.md#pyrompt.get_stats)(collection)                             | Get statistics about a collection.                         |

### Classes

| [`PromptCollection`](_autosummary/pyrompt.html.md#pyrompt.PromptCollection)(collection_name, \*[, ...])      | Collection of prompts with MutableMapping interface.   |
|----------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| [`TemplateCollection`](_autosummary/pyrompt.html.md#pyrompt.TemplateCollection)(collection_name, \*[, ...])    | Collection of templates with multi-engine support.     |
| [`PromptMall`](_autosummary/pyrompt.html.md#pyrompt.PromptMall)(workspace_name, \*[, base_path, ...])  | Collection of collections - a "mall" of stores.        |
| [`TemplateEngine`](_autosummary/pyrompt.html.md#pyrompt.TemplateEngine)()                                  | Abstract base class for template engines.              |
| [`SemanticIndex`](_autosummary/pyrompt.html.md#pyrompt.SemanticIndex)(collection, \*[, auto_update, ...]) | Semantic search index for prompts/templates.           |
| [`GitHubPromptCollection`](_autosummary/pyrompt.html.md#pyrompt.GitHubPromptCollection)(repo, \*[, token, ...])    | Prompt collection backed by GitHub repository.         |

### *class* pyrompt.GitHubPromptCollection(repo, , token=None, readonly=True, branch='main', local_cache=None, collection_type='prompts')

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Prompt collection backed by GitHub repository.

Repositories must end with ‘_pyrompt’ suffix for discovery.
Contains prompts/ and/or templates/ directories.

### Examples

```pycon
>>> # Publishing a collection
>>> gh = GitHubPromptCollection(
...     repo='username/my_prompts_pyrompt',
...     token='ghp_...',
...     readonly=False
... )
>>> gh['greeting'] = "Hello, {name}!"
>>> gh.sync()  # Commits and pushes to GitHub
```

#### sync(message='Update prompts via pyrompt')

Push local changes to GitHub.

* **Parameters:**
  **message** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Commit message
* **Raises:**
  [**PermissionError**](https://docs.python.org/3/builtins/exceptions.html#PermissionError) – If collection is readonly

### *class* pyrompt.PromptCollection(collection_name, , base_path=None, with_metadata=False, store_factory=None)

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Collection of prompts with MutableMapping interface.

Backed by file storage via dol, with optional metadata.

### Examples

```pycon
>>> import tempfile
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> prompts['system'] = "You are a helpful assistant."
>>> print(prompts['system'])
You are a helpful assistant.
>>> len(prompts)
1
```

### *class* pyrompt.PromptMall(workspace_name, , base_path=None, collection_names=None, with_metadata=False)

Bases: [`Mapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping)

Collection of collections - a “mall” of stores.

Provides nested access: mall[‘collection_name’][‘prompt_key’]

### Examples

```pycon
>>> mall = PromptMall('my_workspace')
>>> mall['system']['python_expert'] = "You are a Python expert."
>>> mall['templates']['greeting'] = "Hello {name}!"
>>> list(mall.keys())
['system', 'templates']
>>> results = mall.search('python')
```

#### add_collection(name, collection_type='prompt')

Add a new collection to the mall.

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name
  * **collection_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – ‘prompt’ or ‘template’

### Example

```pycon
>>> mall.add_collection('personas', 'prompt')
>>> mall['personas']['analyst'] = "You are a data analyst."
```

#### get_collection_type(name)

Get the type of a collection.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name
* **Return type:**
  [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]
* **Returns:**
  ‘prompt’, ‘template’, or None if not found

#### items()

Get (name, collection) pairs.

#### keys()

Get collection names.

#### remove_collection(name)

Remove a collection from the mall.

#### NOTE
This only removes it from the mall, not from disk.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name

#### search(query, collections=None, \*\*search_kwargs)

Search across multiple collections.

* **Parameters:**
  * **query** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Search query
  * **collections** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Collection names to search (None = all)
  * **\*\*search_kwargs** – Additional args for SemanticIndex.search
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)]]
* **Returns:**
  Dict mapping collection_name -> search results

### Example

```pycon
>>> results = mall.search('python expert', top_k=3)
>>> for coll_name, matches in results.items():
...     print(f"\n{coll_name}:")
...     for key, score in matches:
...         print(f"  {key}: {score:.3f}")
```

#### values()

Get collections.

### *class* pyrompt.SemanticIndex(collection, , auto_update=False, embedding_model='text-embedding-3-small', batch_size=100, embeddings=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Semantic search index for prompts/templates.

Embeds through `embeddings` (a keyword seam; by default `oa.embeddings`, else
`aix.embeddings`) to create vector representations, then supports similarity search.

### Examples

```pycon
>>> from pyrompt import PromptCollection, SemanticIndex
>>> prompts = PromptCollection('my_project')
>>> prompts['python'] = "You are a Python expert."
>>> prompts['data'] = "You specialize in data analysis."
>>> index = SemanticIndex(prompts)
>>> results = index.search("help with pandas", top_k=2)
```

#### add(key)

Add single item to index.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Key of item to add

#### cluster(n_clusters=5)

Cluster prompts/templates into groups.

* **Parameters:**
  **n_clusters** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Number of clusters
* **Returns:**
  Dict mapping cluster_id -> list of keys
* **Raises:**
  [**ImportError**](https://docs.python.org/3/builtins/exceptions.html#ImportError) – If scikit-learn not available

#### rebuild()

Rebuild entire index from current collection.

#### remove(key)

Remove item from index.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Key of item to remove

#### search(query, top_k=5, filters=None, diversity_threshold=None)

Search for similar prompts.

* **Parameters:**
  * **query** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Search query text
  * **top_k** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Number of results to return
  * **filters** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]) – Metadata filters (if collection has metadata)
  * **diversity_threshold** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`float`](https://docs.python.org/3/builtins/functions.html#float)]) – If set, exclude results too similar to each other
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Tuple`](https://docs.python.org/3/library/typing.html#typing.Tuple)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`float`](https://docs.python.org/3/builtins/functions.html#float)]]
* **Returns:**
  List of (key, similarity_score) tuples, sorted by score descending

### Example

```pycon
>>> results = index.search("help with data analysis", top_k=3)
>>> for key, score in results:
...     print(f"{key}: {score:.3f}")
```

### *class* pyrompt.TemplateCollection(collection_name, , base_path=None, with_metadata=False, default_engine='format')

Bases: [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

Collection of templates with multi-engine support.

Automatically detects template engine based on file extension
or content. Provides rendering capabilities.

### Examples

```pycon
>>> import tempfile
>>> templates = TemplateCollection('my_project', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> templates.render('greeting.txt', name='Alice')
'Hello Alice!'
>>> # With Jinja2 (if installed)
>>> templates['greeting.jinja2'] = "Hello {{ name }}!"
>>> templates.render('greeting.jinja2', name='Bob')
'Hello Bob!'
```

#### create_prompt_functions(keys=None, \*\*common_kwargs)

Create an `aix.PromptFuncs` collection from templates (one function per key).

LLM generation routes through `aix` (lazy import).

* **Parameters:**
  * **keys** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Template keys to include (None = all)
  * **\*\*common_kwargs** – Common kwargs for all prompt functions (e.g. ‘model’)
* **Returns:**
  `aix.PromptFuncs` object with a function for each template

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['greeting.txt'] = "Greet {name}"
>>> funcs = tc.create_prompt_functions()
>>> funcs['greeting.txt'](name='Alice')
'Hello Alice!'
```

#### parse(key)

Parse a template to extract structure.

Returns dict with placeholders, defaults, metadata.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)
* **Returns:**
  Dict with ‘placeholders’, ‘defaults’, ‘metadata’

### Example

```pycon
>>> import tempfile
>>> templates = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> info = templates.parse('greeting.txt')
>>> info['placeholders']
['name']
```

#### render(key, \*\*kwargs)

Render a template with provided values.

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered template string

### Example

```pycon
>>> import tempfile
>>> templates = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> templates['greeting.txt'] = "Hello {name}!"
>>> templates.render('greeting.txt', name='Alice')
'Hello Alice!'
```

#### to_prompt_function(key, \*\*prompt_func_kwargs)

Convert template to an AI-enabled function using `aix.prompt_func`.

LLM generation is routed through `aix` (the multi-provider facade) so the
model/provider is switchable. `aix` is imported lazily, only when called.

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **\*\*prompt_func_kwargs** – Additional kwargs for `aix.prompt_func`
    (e.g., ‘model’, ‘temperature’, ‘name’)
* **Returns:**
  Callable function that invokes the LLM with the rendered template

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['explain.txt'] = "Explain {concept} in simple terms."
>>> explain = tc.to_prompt_function('explain.txt')
>>> explain(concept="quantum computing")
'Quantum computing is ...'
```

#### to_prompt_json_function(key, json_schema, \*\*prompt_func_kwargs)

Convert template to a JSON-returning AI function.

Uses `aix.prompt_func(output_schema=dict)`: aix requests JSON and parses it
robustly (tolerating fenced output), returning a parsed dict. `json_schema` is
accepted for API compatibility; aix does best-effort JSON rather than strict
JSON-Schema enforcement. LLM generation routes through `aix` (lazy import).

* **Parameters:**
  * **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template key
  * **json_schema** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Desired JSON schema (kept for API compatibility)
  * **\*\*prompt_func_kwargs** – Additional kwargs for `aix.prompt_func`
* **Returns:**
  Function that returns a parsed JSON dict

### Example

```pycon
>>> import tempfile
>>> from pyrompt import TemplateCollection
>>> tc = TemplateCollection('demo', base_path=tempfile.mkdtemp())
>>> tc['extract.txt'] = "Extract people from: {text}"
>>> extract = tc.to_prompt_json_function('extract.txt', {})
>>> extract(text="Alice met Bob")
{'people': ['Alice', 'Bob']}
```

### *class* pyrompt.TemplateEngine

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

Abstract base class for template engines.

Template engines parse and render templates with different syntaxes.
They must provide:

- name: Unique identifier (e.g., ‘format’, ‘jinja2’)
- extensions: List of file extensions (e.g., [‘.jinja2’, ‘.j2’])
- parse_template: Extract placeholders and defaults
- render: Render template with values
- detect: Optionally detect if content uses this engine

#### detect(content)

Detect if content uses this engine based on syntax.

Used when extension doesn’t clearly indicate engine.
Override to provide content-based detection.

* **Parameters:**
  **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)
* **Returns:**
  True if content appears to use this engine

#### *abstractmethod* parse_template(template_str)

Parse template to extract structure.

* **Parameters:**
  **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
* **Returns:**
  - ‘placeholders’: list of parameter names
  - ’defaults’: dict of default values
  - ’metadata’: any engine-specific info
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

#### *abstractmethod* render(template_str, \*\*kwargs)

Render template with provided values.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **\*\*kwargs** – Values to inject
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string

### pyrompt.clone_collection(repo, local_path, token=None)

Clone a GitHub collection to local directory.

* **Parameters:**
  * **repo** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Repository name (user/repo_pyrompt)
  * **local_path** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Local directory path
  * **token** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional GitHub token

### Example

```pycon
>>> clone_collection(
...     'thorwhalen/awesome_prompts_pyrompt',
...     '/tmp/my_prompts'
... )
```

### pyrompt.create_project_structure(project_name, base_path=None, include_examples=True)

Create a complete project structure for prompt management.

Creates directories and example files for a new pyrompt project.

* **Parameters:**
  * **project_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the project
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path
  * **include_examples** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to include example prompts
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Path to created project directory

### Example

```pycon
>>> path = create_project_structure('my_ai_app')
>>> print(f"Project created at: {path}")
```

### pyrompt.detect_engine(content, extension=None)

Detect appropriate engine for content.

Priority:

1. Extension match (if provided)
2. Content-based detection
3. Default (format)

* **Parameters:**
  * **content** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **extension** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Optional file extension
* **Return type:**
  [`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)
* **Returns:**
  TemplateEngine instance (never None, falls back to ‘format’)

### pyrompt.discover_prompt_collections(search_term=None, min_stars=0, language='Python', max_results=50)

Discover public \*_pyrompt repositories on GitHub.

* **Parameters:**
  * **search_term** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Search query (e.g., “python data”)
  * **min_stars** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Minimum star count
  * **language** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Programming language filter
  * **max_results** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Maximum number of results
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]
* **Returns:**
  List of dicts with repo info (name, description, stars, url)

### Example

```pycon
>>> collections = discover_prompt_collections(
...     search_term='python',
...     min_stars=5
... )
>>> for repo in collections:
...     print(f"{repo['name']}: {repo['stars']} stars")
```

### pyrompt.export_to_dict(collection, include_metadata=True)

Export collection to a dictionary.

* **Parameters:**
  * **collection** – PromptCollection or TemplateCollection
  * **include_metadata** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to include metadata
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘prompts’ and optionally ‘metadata’ keys

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> prompts['system'] = 'You are helpful.'
>>> export_to_dict(prompts, include_metadata=False)
{'prompts': {'system': 'You are helpful.'}}
```

### pyrompt.fork_collection(source, token, organization=None)

Fork a collection to your account or organization.

* **Parameters:**
  * **source** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Source repo (user/repo_pyrompt)
  * **token** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – GitHub token with repo permissions
  * **organization** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional organization to fork to
* **Return type:**
  [`GitHubPromptCollection`](_autosummary/pyrompt.github_integration.html.md#pyrompt.github_integration.GitHubPromptCollection)
* **Returns:**
  GitHubPromptCollection for the new fork

### Example

```pycon
>>> forked = fork_collection(
...     'thorwhalen/awesome_prompts_pyrompt',
...     token='ghp_...'
... )
```

### pyrompt.get_default_base_path()

Get platform-appropriate base path for pyrompt data.

* **Returns:**
  %LOCALAPPDATA%/pyrompt
  - macOS/Linux: ~/.local/share/pyrompt
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### pyrompt.get_engine(name)

Get engine by name.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Engine name (e.g., ‘format’, ‘jinja2’)
* **Return type:**
  [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)]
* **Returns:**
  TemplateEngine instance or None if not found

### pyrompt.get_stats(collection)

Get statistics about a collection.

* **Parameters:**
  **collection** – PromptCollection or TemplateCollection
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with statistics

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> get_stats(prompts)['total_prompts']
0
```

### pyrompt.import_from_dict(collection, prompts, metadata=None)

Import prompts from a dictionary.

* **Parameters:**
  * **collection** – PromptCollection or TemplateCollection
  * **prompts** ([`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Dict mapping keys to prompt/template strings
  * **metadata** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]]) – Optional dict mapping keys to metadata dicts

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> import_from_dict(prompts, {'system': 'You are helpful.', 'user': 'Hello!'})
>>> sorted(prompts)
['system', 'user']
```

### pyrompt.list_available_engines()

List all available template engines with their details.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  Dict mapping engine name to info dict

### Example

```pycon
>>> engines = list_available_engines()
>>> print(engines['format']['extensions'])
['.txt', '']
```

### pyrompt.list_engines()

List all registered engine names.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]
* **Returns:**
  List of engine names

### pyrompt.merge_collections(target, \*sources, conflict_strategy='skip')

Merge multiple collections into a target collection.

* **Parameters:**
  * **target** – Target collection to merge into
  * **\*sources** – Source collections to merge from
  * **conflict_strategy** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – How to handle conflicts (‘skip’, ‘overwrite’, ‘error’)

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> base = tempfile.mkdtemp()
>>> target = PromptCollection('merged', base_path=base)
>>> source1 = PromptCollection('source1', base_path=base)
>>> source1['a'] = 'A'
>>> merge_collections(target, source1, conflict_strategy='skip')
>>> sorted(target)
['a']
```

### pyrompt.quick_setup(project_name, with_templates=True, with_metadata=False, base_path=None)

Quick setup for a new pyrompt project.

Creates both prompt and template collections with sensible defaults.

* **Parameters:**
  * **project_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the project
  * **with_templates** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to create a template collection
  * **with_metadata** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to enable metadata
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘prompts’ and optionally ‘templates’ keys

### Example

```pycon
>>> import tempfile
>>> collections = quick_setup('my_ai_project', base_path=tempfile.mkdtemp())
>>> collections['prompts']['system'] = "You are a helpful assistant."
>>> collections['templates']['greeting.txt'] = "Hello {name}!"
>>> sorted(collections)
['prompts', 'templates']
```

### pyrompt.register_engine(engine)

Register a template engine.

* **Parameters:**
  **engine** ([`TemplateEngine`](_autosummary/pyrompt.engines.html.md#pyrompt.engines.TemplateEngine)) – TemplateEngine instance to register

### pyrompt.render_template_file(file_path, output_path=None, \*\*kwargs)

Render a template file directly.

* **Parameters:**
  * **file_path** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Path to template file
  * **output_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional path to save rendered output
  * **\*\*kwargs** – Template parameters
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string

### Example

```pycon
>>> result = render_template_file(
...     'templates/greeting.txt',
...     name='Alice'
... )
```

### pyrompt.validate_template(template_str, engine_name='format', required_params=None)

Validate a template string.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **engine_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Engine to use (‘format’, ‘jinja2’, ‘mustache’)
  * **required_params** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Optional list of required parameter names
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘valid’, ‘errors’, ‘warnings’, ‘placeholders’

### Example

```pycon
>>> result = validate_template("Hello {name}!", required_params=['name'])
>>> assert result['valid']
>>> result = validate_template("Hello {name}!", required_params=['name', 'age'])
>>> assert not result['valid']
```

### Modules

| [`base`](_autosummary/pyrompt.base.html.md#module-pyrompt.base)                             | Core collection classes for prompts and templates.                 |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| [`cli`](_autosummary/pyrompt.cli.html.md#module-pyrompt.cli)                               | Command-line interface for pyrompt.                                |
| [`engines`](_autosummary/pyrompt.engines.html.md#module-pyrompt.engines)                       | Template engine plugin system for pyrompt.                         |
| [`github_integration`](_autosummary/pyrompt.github_integration.html.md#module-pyrompt.github_integration) | GitHub integration for sharing and discovering prompt collections. |
| [`mall`](_autosummary/pyrompt.mall.html.md#module-pyrompt.mall)                             | Collection of collections - a "mall" of prompt/template stores.    |
| [`search`](_autosummary/pyrompt.search.html.md#module-pyrompt.search)                         | Semantic search for prompts and templates using embeddings.        |
| [`stores`](_autosummary/pyrompt.stores.html.md#module-pyrompt.stores)                         | Storage layer for pyrompt using dol abstractions.                  |
| [`util`](_autosummary/pyrompt.util.html.md#module-pyrompt.util)                             | Utility functions and convenience helpers for pyrompt.             |


# _autosummary/pyrompt.mall.html.md

# pyrompt.mall

Collection of collections - a “mall” of prompt/template stores.

Provides nested access: mall[‘collection_name’][‘prompt_key’]

### Classes

| [`PromptMall`](_autosummary/pyrompt.mall.html.md#pyrompt.mall.PromptMall)(workspace_name, \*[, base_path, ...])   | Collection of collections - a "mall" of stores.   |
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------|

### *class* pyrompt.mall.PromptMall(workspace_name, , base_path=None, collection_names=None, with_metadata=False)

Bases: [`Mapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping)

Collection of collections - a “mall” of stores.

Provides nested access: mall[‘collection_name’][‘prompt_key’]

### Examples

```pycon
>>> mall = PromptMall('my_workspace')
>>> mall['system']['python_expert'] = "You are a Python expert."
>>> mall['templates']['greeting'] = "Hello {name}!"
>>> list(mall.keys())
['system', 'templates']
>>> results = mall.search('python')
```

#### add_collection(name, collection_type='prompt')

Add a new collection to the mall.

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name
  * **collection_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – ‘prompt’ or ‘template’

### Example

```pycon
>>> mall.add_collection('personas', 'prompt')
>>> mall['personas']['analyst'] = "You are a data analyst."
```

#### get_collection_type(name)

Get the type of a collection.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name
* **Return type:**
  [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]
* **Returns:**
  ‘prompt’, ‘template’, or None if not found

#### items()

Get (name, collection) pairs.

#### keys()

Get collection names.

#### remove_collection(name)

Remove a collection from the mall.

#### NOTE
This only removes it from the mall, not from disk.

* **Parameters:**
  **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Collection name

#### search(query, collections=None, \*\*search_kwargs)

Search across multiple collections.

* **Parameters:**
  * **query** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Search query
  * **collections** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Collection names to search (None = all)
  * **\*\*search_kwargs** – Additional args for SemanticIndex.search
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)]]
* **Returns:**
  Dict mapping collection_name -> search results

### Example

```pycon
>>> results = mall.search('python expert', top_k=3)
>>> for coll_name, matches in results.items():
...     print(f"\n{coll_name}:")
...     for key, score in matches:
...         print(f"  {key}: {score:.3f}")
```

#### values()

Get collections.


# _autosummary/pyrompt.search.html.md

# pyrompt.search

Semantic search for prompts and templates using embeddings.

Provides similarity-based search over collections.

### Functions

| [`default_embeddings`](_autosummary/pyrompt.search.html.md#pyrompt.search.default_embeddings)()   | The embedding function used when none is passed: `oa.embeddings`, else `aix.embeddings`.   |
|-------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|

### Classes

| [`SemanticIndex`](_autosummary/pyrompt.search.html.md#pyrompt.search.SemanticIndex)(collection, \*[, auto_update, ...])   | Semantic search index for prompts/templates.   |
|------------------------------------------------------------------------------------------------------|------------------------------------------------|

### *class* pyrompt.search.SemanticIndex(collection, , auto_update=False, embedding_model='text-embedding-3-small', batch_size=100, embeddings=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Semantic search index for prompts/templates.

Embeds through `embeddings` (a keyword seam; by default `oa.embeddings`, else
`aix.embeddings`) to create vector representations, then supports similarity search.

### Examples

```pycon
>>> from pyrompt import PromptCollection, SemanticIndex
>>> prompts = PromptCollection('my_project')
>>> prompts['python'] = "You are a Python expert."
>>> prompts['data'] = "You specialize in data analysis."
>>> index = SemanticIndex(prompts)
>>> results = index.search("help with pandas", top_k=2)
```

#### add(key)

Add single item to index.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Key of item to add

#### cluster(n_clusters=5)

Cluster prompts/templates into groups.

* **Parameters:**
  **n_clusters** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Number of clusters
* **Returns:**
  Dict mapping cluster_id -> list of keys
* **Raises:**
  [**ImportError**](https://docs.python.org/3/builtins/exceptions.html#ImportError) – If scikit-learn not available

#### rebuild()

Rebuild entire index from current collection.

#### remove(key)

Remove item from index.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Key of item to remove

#### search(query, top_k=5, filters=None, diversity_threshold=None)

Search for similar prompts.

* **Parameters:**
  * **query** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Search query text
  * **top_k** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Number of results to return
  * **filters** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]) – Metadata filters (if collection has metadata)
  * **diversity_threshold** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`float`](https://docs.python.org/3/builtins/functions.html#float)]) – If set, exclude results too similar to each other
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Tuple`](https://docs.python.org/3/library/typing.html#typing.Tuple)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`float`](https://docs.python.org/3/builtins/functions.html#float)]]
* **Returns:**
  List of (key, similarity_score) tuples, sorted by score descending

### Example

```pycon
>>> results = index.search("help with data analysis", top_k=3)
>>> for key, score in results:
...     print(f"{key}: {score:.3f}")
```

### pyrompt.search.default_embeddings()

The embedding function used when none is passed: `oa.embeddings`, else `aix.embeddings`.

Both take `(text_or_texts, model=...)` and return a vector, or one vector per text.
Raises `ImportError` naming both when neither is installed.

* **Return type:**
  [`Callable`](https://docs.python.org/3/library/typing.html#typing.Callable)


# _autosummary/pyrompt.stores.html.md

# pyrompt.stores

Storage layer for pyrompt using dol abstractions.

Provides clean Mapping/MutableMapping interfaces to filesystem storage.

### Functions

| [`get_default_base_path`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.get_default_base_path)()                          | Get platform-appropriate base path for pyrompt data.      |
|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [`mk_collection_path`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.mk_collection_path)(collection_name[, base_path]) | Get the path for a collection.                            |
| [`mk_collection_stores`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.mk_collection_stores)(collection_name[, ...])     | Create all stores for a collection.                       |
| [`mk_metadata_store`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.mk_metadata_store)(rootdir[, for_type])           | Create a JSON metadata store.                             |
| [`mk_prompt_store`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.mk_prompt_store)(rootdir[, extension])            | Create a file store for prompts with clean interface.     |
| [`mk_template_store`](_autosummary/pyrompt.stores.html.md#pyrompt.stores.mk_template_store)(rootdir[, extensions])         | Create a template store that handles multiple extensions. |

### pyrompt.stores.get_default_base_path()

Get platform-appropriate base path for pyrompt data.

* **Returns:**
  %LOCALAPPDATA%/pyrompt
  - macOS/Linux: ~/.local/share/pyrompt
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### pyrompt.stores.mk_collection_path(collection_name, base_path=None)

Get the path for a collection.

* **Parameters:**
  * **collection_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the collection
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path (uses default if None)
* **Return type:**
  [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)
* **Returns:**
  Path object for the collection directory

### pyrompt.stores.mk_collection_stores(collection_name, base_path=None, create_metadata=False)

Create all stores for a collection.

* **Parameters:**
  * **collection_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the collection
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path
  * **create_metadata** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to create metadata stores
* **Returns:**
  ‘prompts’, ‘templates’, and optionally ‘prompt_meta’, ‘template_meta’
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### pyrompt.stores.mk_metadata_store(rootdir, for_type='prompts')

Create a JSON metadata store.

* **Parameters:**
  * **rootdir** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Directory to store metadata
  * **for_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Type of metadata (just for documentation)
* **Returns:**
  MutableMapping[str, dict] with JSON file storage

### Example

```pycon
>>> store = mk_metadata_store('/tmp/meta')
>>> store['greeting'] = {'author': 'thor', 'version': '1.0'}
>>> meta = store['greeting']
```

### pyrompt.stores.mk_prompt_store(rootdir, extension='txt')

Create a file store for prompts with clean interface.

- Keys don’t show extension
- Values are strings (not bytes)
- Supports tab completion

* **Parameters:**
  * **rootdir** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Directory to store prompts
  * **extension** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – File extension (without dot)
* **Returns:**
  MutableMapping[str, str] with file-backed storage

### Example

```pycon
>>> store = mk_prompt_store('/tmp/prompts')
>>> store['greeting'] = "Hello, {name}!"
>>> print(store['greeting'])
Hello, {name}!
```

### pyrompt.stores.mk_template_store(rootdir, extensions=None)

Create a template store that handles multiple extensions.

Keeps the extension in the key so we can detect template engine.

* **Parameters:**
  * **rootdir** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Directory to store templates
  * **extensions** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`list`](https://docs.python.org/3/builtins/stdtypes.html#list)]) – List of extensions to support (with dots)
    Defaults to [‘.txt’, ‘.jinja2’, ‘.j2’, ‘.jinja’, ‘.mustache’, ‘.hbs’]
* **Returns:**
  MutableMapping[str, str] with file-backed storage

### Example

```pycon
>>> store = mk_template_store('/tmp/templates')
>>> store['greeting.jinja2'] = "Hello {{ name }}!"
>>> store['simple.txt'] = "Hello {name}!"
```


# _autosummary/pyrompt.util.html.md

# pyrompt.util

Utility functions and convenience helpers for pyrompt.

### Functions

| [`quick_setup`](_autosummary/pyrompt.util.html.md#pyrompt.util.quick_setup)(project_name[, with_templates, ...])   | Quick setup for a new pyrompt project.                     |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [`import_from_dict`](_autosummary/pyrompt.util.html.md#pyrompt.util.import_from_dict)(collection, prompts[, metadata])  | Import prompts from a dictionary.                          |
| [`export_to_dict`](_autosummary/pyrompt.util.html.md#pyrompt.util.export_to_dict)(collection[, include_metadata])     | Export collection to a dictionary.                         |
| [`validate_template`](_autosummary/pyrompt.util.html.md#pyrompt.util.validate_template)(template_str[, ...])             | Validate a template string.                                |
| [`merge_collections`](_autosummary/pyrompt.util.html.md#pyrompt.util.merge_collections)(target, \*sources[, ...])        | Merge multiple collections into a target collection.       |
| [`list_available_engines`](_autosummary/pyrompt.util.html.md#pyrompt.util.list_available_engines)()                           | List all available template engines with their details.    |
| [`render_template_file`](_autosummary/pyrompt.util.html.md#pyrompt.util.render_template_file)(file_path[, output_path])     | Render a template file directly.                           |
| [`create_project_structure`](_autosummary/pyrompt.util.html.md#pyrompt.util.create_project_structure)(project_name[, ...])      | Create a complete project structure for prompt management. |
| [`get_stats`](_autosummary/pyrompt.util.html.md#pyrompt.util.get_stats)(collection)                              | Get statistics about a collection.                         |

### pyrompt.util.create_project_structure(project_name, base_path=None, include_examples=True)

Create a complete project structure for prompt management.

Creates directories and example files for a new pyrompt project.

* **Parameters:**
  * **project_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the project
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path
  * **include_examples** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to include example prompts
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Path to created project directory

### Example

```pycon
>>> path = create_project_structure('my_ai_app')
>>> print(f"Project created at: {path}")
```

### pyrompt.util.export_to_dict(collection, include_metadata=True)

Export collection to a dictionary.

* **Parameters:**
  * **collection** – PromptCollection or TemplateCollection
  * **include_metadata** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to include metadata
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘prompts’ and optionally ‘metadata’ keys

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> prompts['system'] = 'You are helpful.'
>>> export_to_dict(prompts, include_metadata=False)
{'prompts': {'system': 'You are helpful.'}}
```

### pyrompt.util.get_stats(collection)

Get statistics about a collection.

* **Parameters:**
  **collection** – PromptCollection or TemplateCollection
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with statistics

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> get_stats(prompts)['total_prompts']
0
```

### pyrompt.util.import_from_dict(collection, prompts, metadata=None)

Import prompts from a dictionary.

* **Parameters:**
  * **collection** – PromptCollection or TemplateCollection
  * **prompts** ([`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Dict mapping keys to prompt/template strings
  * **metadata** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)]]) – Optional dict mapping keys to metadata dicts

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> prompts = PromptCollection('my_project', base_path=tempfile.mkdtemp())
>>> import_from_dict(prompts, {'system': 'You are helpful.', 'user': 'Hello!'})
>>> sorted(prompts)
['system', 'user']
```

### pyrompt.util.list_available_engines()

List all available template engines with their details.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  Dict mapping engine name to info dict

### Example

```pycon
>>> engines = list_available_engines()
>>> print(engines['format']['extensions'])
['.txt', '']
```

### pyrompt.util.merge_collections(target, \*sources, conflict_strategy='skip')

Merge multiple collections into a target collection.

* **Parameters:**
  * **target** – Target collection to merge into
  * **\*sources** – Source collections to merge from
  * **conflict_strategy** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – How to handle conflicts (‘skip’, ‘overwrite’, ‘error’)

### Example

```pycon
>>> import tempfile
>>> from pyrompt import PromptCollection
>>> base = tempfile.mkdtemp()
>>> target = PromptCollection('merged', base_path=base)
>>> source1 = PromptCollection('source1', base_path=base)
>>> source1['a'] = 'A'
>>> merge_collections(target, source1, conflict_strategy='skip')
>>> sorted(target)
['a']
```

### pyrompt.util.quick_setup(project_name, with_templates=True, with_metadata=False, base_path=None)

Quick setup for a new pyrompt project.

Creates both prompt and template collections with sensible defaults.

* **Parameters:**
  * **project_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the project
  * **with_templates** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to create a template collection
  * **with_metadata** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Whether to enable metadata
  * **base_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional base path
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘prompts’ and optionally ‘templates’ keys

### Example

```pycon
>>> import tempfile
>>> collections = quick_setup('my_ai_project', base_path=tempfile.mkdtemp())
>>> collections['prompts']['system'] = "You are a helpful assistant."
>>> collections['templates']['greeting.txt'] = "Hello {name}!"
>>> sorted(collections)
['prompts', 'templates']
```

### pyrompt.util.render_template_file(file_path, output_path=None, \*\*kwargs)

Render a template file directly.

* **Parameters:**
  * **file_path** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Path to template file
  * **output_path** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Optional path to save rendered output
  * **\*\*kwargs** – Template parameters
* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)
* **Returns:**
  Rendered string

### Example

```pycon
>>> result = render_template_file(
...     'templates/greeting.txt',
...     name='Alice'
... )
```

### pyrompt.util.validate_template(template_str, engine_name='format', required_params=None)

Validate a template string.

* **Parameters:**
  * **template_str** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Template content
  * **engine_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Engine to use (‘format’, ‘jinja2’, ‘mustache’)
  * **required_params** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Optional list of required parameter names
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Dict with ‘valid’, ‘errors’, ‘warnings’, ‘placeholders’

### Example

```pycon
>>> result = validate_template("Hello {name}!", required_params=['name'])
>>> assert result['valid']
>>> result = validate_template("Hello {name}!", required_params=['name', 'age'])
>>> assert not result['valid']
```


# about-this-build.html.md

<!-- generated by epythet -->

# About this build

This documentation was built on **2026-11-23 07:13 UTC** from commit <a href="https://github.com/addaix/pyrompt/commit/68ddc38f5ab380b9034d0315c6ddbb53a4e53d09"><code>68ddc38</code></a> on branch <code>main</code>, for **pyrompt 0.0.14** (from <code>pyproject.toml</code>).

#### WARNING
The documentation and the package may be misaligned:

- The documented version (0.0.14) is ahead of the latest release on PyPI (0.0.13): these docs describe unreleased code.

## Source

|                     |                                                                                                                                                       |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| Commit              | <a href="https://github.com/addaix/pyrompt/commit/68ddc38f5ab380b9034d0315c6ddbb53a4e53d09"><code>68ddc38f5ab380b9034d0315c6ddbb53a4e53d09</code></a> |
| Branch              | <code>main</code>                                                                                                                                     |
| Tags at this commit | <code>0.0.14</code>                                                                                                                                   |
| Working tree        | clean                                                                                                                                                 |
| Remote              | <code>https://github.com/addaix/pyrompt</code>                                                                                                        |

## Continuous integration

|              |                                                                                            |
|--------------|--------------------------------------------------------------------------------------------|
| Repository   | <code>addaix/pyrompt</code>                                                                |
| Run          | <a href="https://github.com/addaix/pyrompt/actions/runs/45129328515">45129328515</a>       |
| Ref          | <code>refs/heads/main</code>                                                               |
| Event commit | <code>5cecadb761918261c1c7788ac43cbab681ec345f</code> (in the history of the built commit) |

## Tools

|          |         |
|----------|---------|
| epythet  | 0.2.24  |
| Sphinx   | 9.1.1   |
| docutils | 0.22.4  |
| Python   | 3.12.16 |

## Configuration as resolved

|               |                                                                  |
|---------------|------------------------------------------------------------------|
| theme         | <code>auto</code> (Sphinx theme <code>shibuya</code>)            |
| accent        | <code>#903a00</code>                                             |
| api_generator | <code>autosummary</code>                                         |
| ignore        | <code>tests/</code>, <code>scrap/</code>, <code>examples/</code> |
| agent_outputs | <code>true</code>                                                |
| aggregates    | <code>md</code>                                                  |
| ai_artifacts  | <code>true</code>                                                |

## Package on PyPI

Latest release: <a href="https://pypi.org/project/pyrompt/0.0.13/">0.0.13</a>, older than the documented version (0.0.14).

## Reproduce

```bash
git clone https://github.com/addaix/pyrompt && cd pyrompt
git checkout 68ddc38f5ab380b9034d0315c6ddbb53a4e53d09
pip install "epythet==0.2.24"
epythet quickstart . --ignore tests/ scrap/ examples/
```

The same data, for machines: <a href="build_info.json"><code>build_info.json</code></a> (schema version 1).


# api.html.md

# API reference

| [`pyrompt`](_autosummary/pyrompt.html.md#module-pyrompt)   | pyrompt: Python Prompt Management   |
|---------------------------------------------------------------------------|-------------------------------------|


