Skip to main content

A Python package for template string processing designed for prompt engineering

Project description

SmartDance

SmartDance is a Python package that brings the power of template languages to Python. Inspired by Handlebars and similar languages, SmartDance allows you to embed Python function calls and variables directly into your strings, which are then executed and replaced with their results when the string is processed.

Designed specifically to work as a Prompt Engineering tool, SmartDance is a simple, flexible, and powerful way to generate strings from Python code.

Features

  • Simple Syntax: Use double curly braces {{}} to embed Python function calls and variables into your strings.
  • Flexible: SmartDance can handle any function or variable that's in scope when the string is processed.
  • Error Handling: Function execution is wrapped in a try/except block. If an exception is raised, a custom error message is returned. Installation

You can install SmartDance with pip:

pip install smartdance

Usage

from smartdance import dance

def hello(name):
    return f"Hello, {name}!"

print(dance("{{hello('World')}}", locals()))
Output: Hello, World!

Future Plans

  • Complex Data Types: We plan to add support for complex data types like lists, dictionaries, and objects in the future.
  • Debugging and Testing: We plan to add built-in functionality for debugging and testing in the future.

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

smartdance-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

smartdance-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartdance-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for smartdance-0.1.0.tar.gz
Algorithm Hash digest
SHA256 493050199a4ec73fc4b226d532af894d7b83e0959542faeaddba6563a9bd4702
MD5 80c32a6720a07e7b16d7159c62bcfc2a
BLAKE2b-256 3641fdcaac0a72f8211ae85f94562bd2b30e6cee84b3fff69691818166b400e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartdance-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for smartdance-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13694978299be5dcf9d4c23962532b5bb085347736816ac4c6a185b297db6e28
MD5 92d61bd74b45d2a286d5cae91ecba551
BLAKE2b-256 433616abc539d7e64693bcd8a0a7935b39f6e8d4a8ce06b386d126730c6b979d

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