Fluent builder API for Adaptive Cards
Project description
FluentCards — Python
A Python library for building Adaptive Cards using a fluent builder pattern with strong typing and built-in schema validation.
Also available for .NET (NuGet), Node.js (npm), and Go.
Installation
pip install fluent-cards
Quick Start
from fluent_cards import AdaptiveCardBuilder, TextSize, TextWeight, to_json
card = (AdaptiveCardBuilder.create()
.with_version('1.5')
.add_text_block(lambda tb: tb
.with_text('Hello, FluentCards!')
.with_size(TextSize.Large)
.with_weight(TextWeight.Bolder)
.with_wrap(True))
.add_action(lambda a: a
.open_url('https://adaptivecards.io')
.with_title('Learn More'))
.build())
print(to_json(card))
Output:
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "Hello, FluentCards!",
"size": "Large",
"weight": "Bolder",
"wrap": true
}
],
"actions": [
{
"type": "Action.OpenUrl",
"url": "https://adaptivecards.io",
"title": "Learn More"
}
]
}
Features
- Fluent builder API — chainable, readable card construction
- Strong typing — enums for all Adaptive Cards schema values (
TextSize,TextWeight,Colors,ContainerStyle, etc.) - Built-in validation — catches schema errors before the card is sent
- Zero dependencies — pure Python, no third-party packages required
- Full schema support — TextBlock, Image, ColumnSet, Container, FactSet, ActionSet, and more
More Examples
Card with image and actions
from fluent_cards import AdaptiveCardBuilder, TextSize, TextWeight, ActionStyle
card = (AdaptiveCardBuilder.create()
.with_version('1.5')
.add_text_block(lambda tb: tb
.with_text('Order Confirmed')
.with_size(TextSize.Large)
.with_weight(TextWeight.Bolder))
.add_text_block(lambda tb: tb
.with_text('Your order #12345 has been placed.')
.with_wrap(True))
.add_action(lambda a: a
.open_url('https://example.com/track/12345')
.with_title('Track Order'))
.build())
Card with columns
from fluent_cards import AdaptiveCardBuilder
card = (AdaptiveCardBuilder.create()
.with_version('1.5')
.add_column_set(lambda cs: cs
.add_column(lambda col: col
.with_width('auto')
.add_text_block(lambda tb: tb.with_text('Name:')))
.add_column(lambda col: col
.with_width('stretch')
.add_text_block(lambda tb: tb.with_text('Jane Doe'))))
.build())
Using choices (Input.ChoiceSet)
from fluent_cards import AdaptiveCardBuilder
card = (AdaptiveCardBuilder.create()
.with_version('1.5')
.add_input_choice_set(lambda cs: cs
.with_id('priority')
.with_label('Priority')
.add_choice('High', 'high')
.add_choice('Medium', 'medium')
.add_choice('Low', 'low'))
.build())
Validation
from fluent_cards import AdaptiveCardBuilder, validate
card = AdaptiveCardBuilder.create().build() # no version set
errors = validate(card)
for error in errors:
print(error)
API Reference
See the full API docs for all builder methods and enums.
Development
git clone https://github.com/rido-min/FluentCards.git
cd FluentCards/python
pip install -e ".[dev]"
pytest
License
MIT — see LICENSE for details.
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 fluent_cards-0.2.0b1.tar.gz.
File metadata
- Download URL: fluent_cards-0.2.0b1.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b4a95de41a8c9c0b964aaa63ece6af8f5bd952d359080a6c5666f7b86ab17bc
|
|
| MD5 |
4ebc8253537788fe11420ffa8df91ffc
|
|
| BLAKE2b-256 |
7df6d953d858ba77ca32a2db63af443f8bc19481492d97178d47210dbc2c6848
|
Provenance
The following attestation bundles were made for fluent_cards-0.2.0b1.tar.gz:
Publisher:
cd.yml on rido-min/FluentCards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluent_cards-0.2.0b1.tar.gz -
Subject digest:
7b4a95de41a8c9c0b964aaa63ece6af8f5bd952d359080a6c5666f7b86ab17bc - Sigstore transparency entry: 1309854273
- Sigstore integration time:
-
Permalink:
rido-min/FluentCards@2c588dbebfc06c99bc077a3e4f8fa33d328f830a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rido-min
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@2c588dbebfc06c99bc077a3e4f8fa33d328f830a -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file fluent_cards-0.2.0b1-py3-none-any.whl.
File metadata
- Download URL: fluent_cards-0.2.0b1-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d462dec696dbf8471b369ab8bc903c7c5b79845cf28d2f4fac0fb203fc2b98d
|
|
| MD5 |
6a2600087c274139797be778c8d0dc25
|
|
| BLAKE2b-256 |
5adcbc21086081cd1d4aa70c1513c1b15b02ae6a3f2b29519f0a07efef29ad70
|
Provenance
The following attestation bundles were made for fluent_cards-0.2.0b1-py3-none-any.whl:
Publisher:
cd.yml on rido-min/FluentCards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluent_cards-0.2.0b1-py3-none-any.whl -
Subject digest:
7d462dec696dbf8471b369ab8bc903c7c5b79845cf28d2f4fac0fb203fc2b98d - Sigstore transparency entry: 1309854422
- Sigstore integration time:
-
Permalink:
rido-min/FluentCards@2c588dbebfc06c99bc077a3e4f8fa33d328f830a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rido-min
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@2c588dbebfc06c99bc077a3e4f8fa33d328f830a -
Trigger Event:
workflow_run
-
Statement type: