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!

How to update the package

  1. Update the version in setup.py
  2. Run the following command to build the package:
python setup.py sdist bdist_wheel
  1. Run the following command to upload the package to PyPI:
twine upload dist/*
  1. Update the package in the project:
pip install --upgrade smartdance

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-3.0.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

smartdance-3.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smartdance-3.0.0.tar.gz
Algorithm Hash digest
SHA256 76fc309d395d3ecca44a60b9a1cc7491fb3edf026b76136c090a94f691cd2b71
MD5 daf3d2fc7b7dad01ff92e8bf527f2cef
BLAKE2b-256 c7527c57a14f1c7b8ba4ca3194ca5cad7a64342d7219e53a7c72bd24fdace8b6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smartdance-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df994490902131f48bab97c6b2b7e3de3220e9f9a1938b6224ab167af78bd4f1
MD5 3e4bae4f2aad3820b89e15cee3a1e0cf
BLAKE2b-256 e335151149c544e279d5935d5af56c9e793313f2b7dfc219d24a9de1a60ad600

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