Skip to main content

Python port of YAPL (Yet Another Prompt Language) renderer.

Project description

yapl-py

Python port of YAPL (Yet Another Prompt Language) renderer.

Installation

  • From PyPI (once published): pip install yapl-py

  • From source (editable): pip install -e .

Usage

See tests in tests/ for examples of loading and rendering templates programmatically.

Basic example:

from yapl_py import YAPL, YAPLOptions, WhitespaceOptions

yapl = YAPL(YAPLOptions(
    baseDir="/path/to/prompts",
    strictPaths=True,
    whitespace=WhitespaceOptions(trimBlocks=True, lstripBlocks=True, dedentBlocks=True),
))

prompt = yapl.render("prompts/examples/conditional-agent.md.yapl", {
    "user_type": "expert",
    "domain": "TypeScript",
    "include_examples": True,
})
print(prompt.content)

Development

  • Run tests: pytest -q

  • Build the package locally: python -m pip install build python -m build

Artifacts will be generated under dist/.

Releasing to PyPI

This repository includes a GitHub Actions workflow at .github/workflows/publish.yml that builds and publishes the package to PyPI when you push a Git tag that starts with v (for example, v0.1.0).

Steps:

  1. Create a PyPI API token (User settings -> API tokens) with project-wide or scoped permissions.
  2. In your GitHub repository settings, add a repository secret named PYPI_API_TOKEN and paste the token value.
  3. Create and push a tag: git tag v0.1.0 git push origin v0.1.0

The workflow will:

  • Check out the repository
  • Build sdist and wheel
  • Publish to PyPI using pypa/gh-action-pypi-publish

License

Specify your license here, e.g. MIT.

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

yapl_py-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

yapl_py-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yapl_py-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yapl_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7b52223fb82374748a9bfcf15d0bc889f030f46028a35f186afb3ba7e43d4d4
MD5 625c50ed13c16cb285f4ee5c68d297a4
BLAKE2b-256 c18136e9fc5282b50e2a73b518d2c4ba4342c22234fc73e52701380d7bb2a4f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yapl_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yapl_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca83b8d0717329f4659198cbc740b72fdf7a4374474243fd557767cd0a8ceb94
MD5 8a198f3c2047ab1250682d90f9c2b9f4
BLAKE2b-256 41fcb057f1929c9cced941e02716b750f5a429ba53b72d847b9db0d3fbcbbaff

See more details on using hashes here.

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