A minimal library to make Chainlit easier to use.
Project description
Easierlit
Easierlit is a thin wrapper over Chainlit for writing Python-first chat apps with a simple split:
EasierlitServer: runs the Chainlit server in the main process.EasierlitClient: runs your app logic (run_func) in a worker.EasierlitApp: bridges incoming user messages and outgoing commands.
This README documents Easierlit v0.1.0.
Install
pip install easierlit
For local development:
pip install -e .
60-Second Quick Start
from easierlit import AppClosedError, EasierlitClient, EasierlitServer
def run_func(app):
while True:
try:
incoming = app.recv(timeout=1.0)
except TimeoutError:
continue
except AppClosedError:
break
app.send(
thread_id=incoming.thread_id,
content=f"Echo: {incoming.content}",
author="EchoBot",
)
client = EasierlitClient(run_func=run_func, worker_mode="thread")
server = EasierlitServer(client=client)
server.serve()
Core Concepts
run_func(app)is your main loop.app.recv()blocks until a user message arrives.app.send()and related APIs emit assistant-side output.server.serve()is blocking and starts Chainlit headless.
Lifecycle summary:
server.serve() -> Chainlit callbacks -> app.recv() in worker -> app.send() / client.* CRUD
Public API (v0.1.0)
EasierlitServer(
client,
host="127.0.0.1",
port=8000,
root_path="",
auth=None,
persistence=None,
)
EasierlitClient(run_func, worker_mode="thread")
EasierlitApp.recv(timeout=None)
EasierlitApp.send(thread_id, content, author="Assistant", metadata=None)
EasierlitApp.update_message(thread_id, message_id, content, metadata=None)
EasierlitApp.delete_message(thread_id, message_id)
EasierlitApp.close()
EasierlitAuthConfig(username, password, identifier=None, metadata=None)
EasierlitPersistenceConfig(enabled=True, sqlite_path=".chainlit/easierlit.db")
Auth and Persistence Defaults
- JWT secret is auto-managed at
.chainlit/jwt.secret. - Auth cookie name is fixed to
easierlit_access_token. - Default persistence is SQLite at
.chainlit/easierlit.db. - If SQLite schema is incompatible, Easierlit recreates it with backup.
- Sidebar default state is forced to
open.
Thread History Visibility
Chainlit shows Thread History when both conditions are true:
requireLogin=TruedataPersistence=True
In Easierlit, this usually means:
- set
auth=EasierlitAuthConfig(...) - keep persistence enabled (default)
Message CRUD and Thread CRUD
Message APIs:
app.send(...)app.update_message(...)app.delete_message(...)client.add_message(...)client.update_message(...)client.delete_message(...)
Thread APIs (via data layer):
client.list_threads(...)client.get_thread(thread_id)client.update_thread(...)client.delete_thread(thread_id)
Important runtime behavior:
- With auth configured,
client.update_thread(...)auto-assigns ownership to the auth user. - For SQLite SQLAlchemyDataLayer, Easierlit auto serializes/deserializes thread
tags. - If no active websocket session exists, Easierlit runs data-layer message fallback with internal HTTP context initialization.
Worker Failure Policy
Easierlit is fail-fast:
- If
run_funcraises, server shutdown is triggered immediately. - UI receives a short summary when possible.
- Full traceback is logged on the server side.
Message vs Tool Call in Chainlit
Chainlit distinguishes these at the step type level.
Message types:
user_messageassistant_messagesystem_message
Tool/run types include:
toolrunllmretrievalembeddingrerank
Easierlit v0.1.0 behavior:
app.recv()consumes user-message flow.app.send()andclient.add_message()produce assistant-message flow.- Easierlit public API does not expose a dedicated tool-call step creation API yet.
UI rendering note (Chainlit): ui.cot supports full, tool_call, hidden.
Example Map
examples/minimal.py: basic echo bot.examples/custom_auth.py: single-account auth setup.examples/thread_crud.py: list/get/update/delete thread flow.examples/thread_create_in_run_func.py: create a new thread fromrun_func.
Documentation
- API reference (EN, method-level contracts):
docs/api-reference.en.md - API reference (KO):
docs/api-reference.ko.md - Detailed guide (EN):
docs/usage.en.md - Korean overview:
README.ko.md - Detailed guide (KO):
docs/usage.ko.md
For exact method contracts (parameters, returns, raises, failure modes), use API Reference first.
Migration Notes
Removed APIs from older drafts are not part of v0.1.0 public usage. Use only the APIs documented above.
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 easierlit-0.1.0.tar.gz.
File metadata
- Download URL: easierlit-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43dc913722f08cd05485de6eaeccfd29c4968404174208ddcc5cf24ca73af787
|
|
| MD5 |
b0ba44ebd22a26afb881db84b35a7f07
|
|
| BLAKE2b-256 |
29af9bd6b27c596ccdc014f0db9f6540a549327eaeceb01186f8bb0617d48515
|
Provenance
The following attestation bundles were made for easierlit-0.1.0.tar.gz:
Publisher:
publish.yml on smturtle2/easierlit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easierlit-0.1.0.tar.gz -
Subject digest:
43dc913722f08cd05485de6eaeccfd29c4968404174208ddcc5cf24ca73af787 - Sigstore transparency entry: 953400355
- Sigstore integration time:
-
Permalink:
smturtle2/easierlit@a8511d43760a9843b27406e3554fe438eccc8169 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8511d43760a9843b27406e3554fe438eccc8169 -
Trigger Event:
push
-
Statement type:
File details
Details for the file easierlit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: easierlit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d1ca5746a72c41d4094636becfc0ed59a8015e6d92b55e9ff3454c4edd9597
|
|
| MD5 |
c05fe4427b519ec33594254729583160
|
|
| BLAKE2b-256 |
c1ce4c054bd650de4aa7f22e10a4b19511af2cf536c1a6199efe52f1af10c7f9
|
Provenance
The following attestation bundles were made for easierlit-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on smturtle2/easierlit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easierlit-0.1.0-py3-none-any.whl -
Subject digest:
a4d1ca5746a72c41d4094636becfc0ed59a8015e6d92b55e9ff3454c4edd9597 - Sigstore transparency entry: 953400360
- Sigstore integration time:
-
Permalink:
smturtle2/easierlit@a8511d43760a9843b27406e3554fe438eccc8169 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8511d43760a9843b27406e3554fe438eccc8169 -
Trigger Event:
push
-
Statement type: