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-2.0.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-2.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartdance-2.0.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-2.0.0.tar.gz
Algorithm Hash digest
SHA256 539b6f85ef00ea2c87c87214162b61bb754fe7f95a7b2f2c7369e8c22e04a1d9
MD5 8746eca3e4ab194f268e50929ba3dbcf
BLAKE2b-256 5c252082c20a96c92c076358c5a6a64a23fdf8c185e1fae25297969089e18ed1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartdance-2.0.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-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca7589c63f74f0257309718374bffb0be69830b80a7b3b1dd9afda7eea3bd748
MD5 b17ed21cb86b1e965224fc37a4f39ae0
BLAKE2b-256 1cd0c309e8971a765371f8f116329f6e7db923cd28483b0dab73334bbc430ca0

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