AirFeedback
Simple feedback collection for Air/FastAPI apps.
Installation
pip install airfeedback
or with uv:
uv add airfeedback
Usage
import air
from airfeedback import AirFeedback
from sqlalchemy.ext.asyncio import AsyncSession
# Define your save callback
async def save_feedback(user_id: int, text: str, route: str | None):
# Your save logic here (DB, file, API call, etc.)
feedback = Feedback(user_id=user_id, text=text, route=route)
async with AsyncSession(engine) as session:
session.add(feedback)
await session.commit()
# Initialize AirFeedback
feedback = AirFeedback(on_save=save_feedback)
# Register the route
app = air.Air()
@app.post("/feedback")
async def submit_feedback(request: air.Request, user: CurrentUser):
return await feedback._submit_handler(request, user)
# In your UI - unstyled by default
feedback.button()
feedback.modal()
# With DaisyUI styling
feedback.button(class_="btn btn-ghost btn-sm")
feedback.modal(
modal_class="modal-box",
title_class="font-bold text-lg mb-4",
textarea_class="textarea textarea-bordered w-full mb-4 min-h-32",
submit_class="btn btn-primary",
cancel_class="btn ml-2"
)
# With custom CSS
feedback.button(class_="my-feedback-btn")
feedback.modal(
textarea_class="my-textarea",
submit_class="my-submit-btn"
)
Configuration
AirFeedback accepts the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
on_save |
Callable[[int, str, str|None], Any] |
Required | Async callback to save feedback. Receives user_id, text, and route |
route_path |
str |
/feedback |
URL path for feedback submission |
button_text |
str |
💬 Feedback |
Text displayed on feedback button |
success_message |
str |
✓ Thanks for your feedback! |
Message shown after successful submission |
error_message |
str |
Feedback cannot be empty |
Message shown when validation fails |
Methods
button(class_="", **kwargs)
Returns a feedback button component. The button automatically captures the current route when clicked.
Parameters:
class_: CSS classes to apply to the button**kwargs: Additional HTML attributes
modal(modal_class="", form_class="", textarea_class="", submit_class="", cancel_class="", title="Share Your Feedback", title_class="", placeholder="...")
Returns a feedback modal component.
Parameters:
modal_class: CSS classes for modal containerform_class: CSS classes for form elementtextarea_class: CSS classes for textareasubmit_class: CSS classes for submit buttoncancel_class: CSS classes for cancel buttontitle: Modal title text (set toNoneto hide)title_class: CSS classes for titleplaceholder: Textarea placeholder text
Features
- Database Agnostic: Uses callback pattern - bring your own storage
- Framework Agnostic CSS: Unstyled by default, works with any CSS framework
- Route Tracking: Automatically captures the page URL where feedback was submitted
- User Flexible: Works with any user object that has an
idattribute
License
MIT License - see LICENSE file for details
Metadata
Release files for airfeedback 0.1.1
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 |
|---|---|---|---|---|
| airfeedback-0.1.1.tar.gz | 3.6 kB | Without provenance | Details for airfeedback-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| airfeedback-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for airfeedback-0.1.1-py3-none-any.whl |
Total release size: 8.4 kB
Release files / airfeedback-0.1.1.tar.gz
| Download URL | airfeedback-0.1.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbfde9fe6e7c7705e6e4b635ba543cf646a86ab4ca3d3d75044d82fc9628d7b4
|
|
BLAKE2b-256 checksum How to use checksums |
b5b61ab3efaa88c02df304a5c33bdc21d94f1d769edf6eef02b9b3f0f9486b54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Release files / airfeedback-0.1.1-py3-none-any.whl
| Download URL | airfeedback-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e645acbdb211b5a505306cc3d3d33d046f547b230b68b7e3ce097e0042772fdc
|
|
BLAKE2b-256 checksum How to use checksums |
0da23fb8e615cec8e1532c03662fe3b7bd3006a099b157e5f7afecd224e8196d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Security for airfeedback 0.1.1
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.