Open Prompt Format for Python
Load and render OPF prompt files from Python.
Install
python -m pip install open-prompt-format
For the current source checkout, run python -m pip install ./packages/python from the repository root.
Use
from opf import load_by_id
prompt = load_by_id("support.reply", "prompts")
messages = prompt.render(customer_message="My order is late.")
print(prompt.source_digest)
messages is an ordered list of dictionaries with role and content strings. See the syntax proposal for file structure and validation rules.
CLI
opf validate prompts/support.reply.md
opf validate-collection prompts
opf render prompts/support.reply.md --input customer_message="My order is late."
opf scan .
opf migrate inspect prompts/legacy.md --role system
opf migrate apply prompts/legacy.md --role system
Migration inspection is read-only. Apply writes only generated paths that are absent or already identical. Supported adapter inputs are intentionally narrow; consult the migration guide for limits and compatibility findings.
Licensed under MIT; see LICENSE.
Git-backed registry
from opf import Registry
registry = Registry.local("opf.yaml")
prepared = registry.get("support.reply", channel="production").render({"customer_message": "Hello"})
print(prepared.messages)
print(prepared.receipt)
The registry also supports release, promote, verify, verify-all, and export through the opf CLI. Run opf verify-all --registry opf.yaml in CI after fetching Git tags. Registry.from_bundle("prompt.json") loads an exported release without Git. Existing Markdown/Jinja projects can use the jinja2 renderer with pip install 'open-prompt-format[jinja]'. The model is selected by the application and can be attached with prepared.call_receipt(provider=..., model=...). See the registry contract.
After opf publish ID@VERSION --to langfuse, Registry.langfuse().get(ID, version=VERSION) explicitly loads the verified remote bundle using Langfuse credentials from the environment.
CLI onboarding and review
The Python distribution includes the opf CLI. opf init . --id support.reply creates a sample prompt, registry entry, and an OPF-owned guidance block in AGENTS.md. Add --github to also create a read-only GitHub Actions workflow that calls the published reusable OPF check workflow. It does not replace existing prompt files or content outside its markers; any conflicting target causes init to stop without partial writes. The generated workflow requires the matching OPF GitHub release and Python package to be published. opf check . validates discovered OPF prompts and registry references locally; --format json and --strict are available for CI.
Use opf diff ID --base VERSION_OR_CHANNEL --target VERSION_OR_WORKING_TREE to inspect source changes and shared prefix evidence. A stable prefix is only a cacheability candidate; it cannot establish a provider cache hit. Heuristic injection findings need human review and do not guarantee safety.
The reusable GitHub workflow has an optional paired Promptfoo job (run-eval, default false). It requires a protected prompt-eval environment with required reviewers and environment-scoped provider keys. It runs the same eval config against the PR base prompt and candidate prompt, writes a sanitized comparison to the workflow summary, skips forks, and deletes raw files. Each comparison makes two sets of provider calls and can cost money. block-on-regression also defaults false; ungraded rows are never counted as passes. Report states are unchanged, regression, improved, changed, error, and ungraded; provider/test/prompt matrix mismatches or missing base files abort comparison. Nondeterminism means a measured regression needs review, and a source diff by itself does not establish behavior quality. The included sample cases validate config wiring only; live model behavior is not verified by ordinary CI.
Metadata
Release files for open-prompt-format 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| open_prompt_format-0.2.0.tar.gz | 46.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_prompt_format-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 97.7 kB
Release files / open_prompt_format-0.2.0.tar.gz
| Download URL | open_prompt_format-0.2.0.tar.gz |
|---|---|
| Size | 46.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
192cbb7b2f417f8ebe3562f29b99277ec9674bdf5972dcaf59d8d8c5a72909ae
|
|
BLAKE2b-256 checksum How to use checksums |
6e509a6d49fa9040840d1c130dfba4c61c6b167c3e517af905e20b9fe0731980
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / open_prompt_format-0.2.0-py3-none-any.whl
| Download URL | open_prompt_format-0.2.0-py3-none-any.whl |
|---|---|
| Size | 50.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d35e7822b9395045c47a38028a0426b13e57eccc36a51726554127f828417be4
|
|
BLAKE2b-256 checksum How to use checksums |
5307a3de4344cce4f4baa086986d09a658026b56b1a81be55a0f1087a0dc65b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logSecurity for open-prompt-format 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for open_prompt_format-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.