Skip to main content

Prompt loading with recursive includes and code substitution.

Project description

pastr

Prompt loading utilities.

Install

After the first PyPI release:

uv add pastr

Fallback before a package release is published:

uv add "pastr @ git+https://github.com/jjstankowicz/pastr.git@v0.1.0"

Release steps are documented in docs/pypi-release.md.

Quick Start

from pathlib import Path

from pastr import load_prompt, set_prompt_directory

# Optional global override.
set_prompt_directory(Path("prompts"))

# Load by tag from prompts/simple.txt
prompt = load_prompt("simple")

# Or pass an explicit root per call.
prompt = load_prompt("simple", prompt_root=Path("prompts"))

# Replace code placeholders like {{FROM_CODE:answer}}.
prompt = load_prompt(
    "simple",
    code_replacements={"answer": "42"},
    prompt_root=Path("prompts"),
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pastr-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pastr-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pastr-0.1.0.tar.gz.

File metadata

  • Download URL: pastr-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pastr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03af7514a59aca549d194c42fa08adda03be8ad6b2a7b2bdc5cd4b3f192fc8bd
MD5 e7885fd343fd13f92dec90434dfcd7d9
BLAKE2b-256 ac6a593da47697fcd81ee763322bc43480a141b138a6ad616b0b643ba3cc786f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pastr-0.1.0.tar.gz:

Publisher: publish-pypi.yml on jjstankowicz/pastr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pastr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pastr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pastr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28b38f5b30a4a114f01372e697b9733aa20bbe7f80aec005839a2a21cc77482e
MD5 4c9560eea1a08790377116b033754d9c
BLAKE2b-256 5cb58404cc5948465b49f77a2bae5dbd59d334fb3c666846cc8d77793abc525e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pastr-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on jjstankowicz/pastr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page