Adaptive Cards Templating for Python
This library largely implements the JSON-to-JSON Adaptive Cards Template language for Python. It allows you to dynamically expand Adaptive Card templates using data and host-specific information.
Features
- Supports most standard features of the Adaptive Cards Template language.
- Inline data expansion with
$data. - Conditional rendering with
$when. - Expression evaluation using
${}syntax. - Custom functions like
if()andjson(). - Supports
$root,$host, and$indexfor advanced templating.
Currently unsupported
- Adaptive expressions prebuilt functions.
Installation
To install the package, use:
pip install adaptive-cards-templating-py
Usage
Here's a quick example of how to use the library:
import json
from adaptive_cards_templating_py import Template
# Define a template
template_json = {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "${message}"
}
]
}
# Create a Template instance
template = Template(template_json)
# Expand the template with data
data = {
"$root": {
"message": "Hello, Adaptive Cards!"
}
}
card = template.expand(data)
# Pretty-print the card
print(json.dumps(card, indent=2))
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Write tests for your changes.
- Commit your changes and push the branch.
- Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for adaptive-cards-templating-py 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adaptive_cards_templating_py-0.1.5.tar.gz | 6.6 kB | Without provenance | Details for adaptive_cards_templating_py-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adaptive_cards_templating_py-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for adaptive_cards_templating_py-0.1.5-py3-none-any.whl |
Total release size: 13.6 kB
Release files / adaptive_cards_templating_py-0.1.5.tar.gz
| Download URL | adaptive_cards_templating_py-0.1.5.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1367cbf0f74db0043278aac9c06bcf6ac092ad577869b5eef68ad03d68e57b39
|
|
BLAKE2b-256 checksum How to use checksums |
fdfa6b1ebaa8670cf36f8e4bb783f85335624ba088d3dc4a74c53f7c6d4bd2e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / adaptive_cards_templating_py-0.1.5-py3-none-any.whl
| Download URL | adaptive_cards_templating_py-0.1.5-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a4ed9ef0e48c7dc66b9addadaf018b4063e08a74f8f6268b83d651ec2b8ec76
|
|
BLAKE2b-256 checksum How to use checksums |
661103d7caf374e125921a45e2364d2cd27c63f57731d221604d29a317f5176f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for adaptive-cards-templating-py 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.