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
- Update the version in
setup.py - Run the following command to build the package:
python setup.py sdist bdist_wheel
- Run the following command to upload the package to PyPI:
twine upload dist/*
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76fc309d395d3ecca44a60b9a1cc7491fb3edf026b76136c090a94f691cd2b71
|
|
| MD5 |
daf3d2fc7b7dad01ff92e8bf527f2cef
|
|
| BLAKE2b-256 |
c7527c57a14f1c7b8ba4ca3194ca5cad7a64342d7219e53a7c72bd24fdace8b6
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df994490902131f48bab97c6b2b7e3de3220e9f9a1938b6224ab167af78bd4f1
|
|
| MD5 |
3e4bae4f2aad3820b89e15cee3a1e0cf
|
|
| BLAKE2b-256 |
e335151149c544e279d5935d5af56c9e793313f2b7dfc219d24a9de1a60ad600
|