Skip to main content

A minimal library to make Chainlit easier to use.

Project description

English | 한국어

Easierlit

Version Python Chainlit

Easierlit is a Python-first wrapper around Chainlit. It keeps the power of Chainlit while reducing the boilerplate for worker loops, message flow, auth, and persistence.

Quick Links

Why Easierlit

  • Clear runtime split:
  • EasierlitServer: runs Chainlit in the main process.
  • EasierlitClient: runs your run_func(app) in one global worker.
  • EasierlitApp: queue bridge for inbound/outbound communication.
  • Production-oriented defaults:
  • headless server mode
  • sidebar default state open
  • JWT secret auto-management (.chainlit/jwt.secret)
  • dedicated auth cookie (easierlit_access_token)
  • fail-fast worker policy
  • Practical persistence behavior:
  • default SQLite bootstrap (.chainlit/easierlit.db)
  • schema compatibility recovery
  • SQLite tags normalization for thread CRUD

Architecture at a Glance

User UI
  -> Chainlit callbacks (on_message / on_chat_start / ...)
  -> Easierlit runtime bridge
  -> EasierlitApp incoming queue
  -> run_func(app) in worker (thread/process)
  -> app.send(...) / client.* CRUD
  -> runtime dispatcher
  -> realtime session OR data-layer fallback

Install

pip install easierlit

For local development:

pip install -e ".[dev]"

Quick Start (60 Seconds)

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()  # blocking

Async worker pattern:

from easierlit import AppClosedError, EasierlitClient, EasierlitServer


async def run_func(app):
    while True:
        try:
            incoming = await app.arecv()
        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",
    run_func_mode="auto",  # auto/sync/async
)
server = EasierlitServer(client=client)
server.serve()

Public API (v0.2.0)

EasierlitServer(
    client,
    host="127.0.0.1",
    port=8000,
    root_path="",
    auth=None,
    persistence=None,
)

EasierlitClient(run_func, worker_mode="thread", run_func_mode="auto")

EasierlitApp.recv(timeout=None)
EasierlitApp.arecv(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")

For exact method contracts, use:

  • docs/api-reference.en.md

This includes parameter constraints, return semantics, exceptions, side effects, concurrency notes, and failure-mode fixes for each public method.

Auth and Persistence Defaults

  • JWT secret: auto-managed at .chainlit/jwt.secret
  • Auth cookie: easierlit_access_token
  • Default persistence: SQLite at .chainlit/easierlit.db
  • If SQLite schema is incompatible, Easierlit recreates DB with backup
  • Sidebar default state is forced to open

Thread History sidebar visibility follows Chainlit policy:

  • requireLogin=True
  • dataPersistence=True

Typical Easierlit setup:

  • set auth=EasierlitAuthConfig(...)
  • keep persistence enabled (default)

Message and Thread Operations

Message APIs:

  • app.send(...)
  • app.update_message(...)
  • app.delete_message(...)
  • client.add_message(...)
  • client.update_message(...)
  • client.delete_message(...)

Thread APIs:

  • client.list_threads(...)
  • client.get_thread(thread_id)
  • client.update_thread(...)
  • client.delete_thread(thread_id)

Behavior highlights:

  • With auth enabled, client.update_thread(...) auto-assigns thread ownership.
  • SQLite SQLAlchemyDataLayer path auto normalizes thread tags.
  • If no active websocket session exists, Easierlit applies internal HTTP-context fallback for data-layer message CRUD.

Worker Failure Policy

Easierlit uses fail-fast behavior for worker crashes.

  • If run_func raises, server shutdown is triggered.
  • UI gets a short summary when possible.
  • Full traceback is kept in server logs.

Chainlit Message vs Tool-call

Chainlit distinguishes message and tool/run categories at step type level.

Message steps:

  • user_message
  • assistant_message
  • system_message

Tool/run family includes:

  • tool, run, llm, embedding, retrieval, rerank, undefined

Easierlit v0.2.0 currently provides message-centric public APIs. A dedicated tool-call step creation public API is not provided yet.

Example Map

  • examples/minimal.py: basic echo bot
  • examples/custom_auth.py: single-account auth
  • examples/thread_crud.py: thread list/get/update/delete
  • examples/thread_create_in_run_func.py: create thread from run_func

Documentation Map

  • Method-level API contracts (EN): docs/api-reference.en.md
  • Method-level API contracts (KO): docs/api-reference.ko.md
  • Full usage guide (EN): docs/usage.en.md
  • Full usage guide (KO): docs/usage.ko.md

Migration Note

Removed APIs from earlier drafts are not part of v0.2.0 public usage. Use the APIs documented in this README and API Reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easierlit-0.2.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easierlit-0.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file easierlit-0.2.0.tar.gz.

File metadata

  • Download URL: easierlit-0.2.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for easierlit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 39bc4178d6f49e7017d7803a0cd6d7527cf34757124c730c6acaea3259cc6483
MD5 2368a3f4a7021d8fd44c8db9837f316e
BLAKE2b-256 f2b043fc1bc21f4c640773093e01c263867b716acb3d1655351413097e68f6d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for easierlit-0.2.0.tar.gz:

Publisher: publish.yml on smturtle2/easierlit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file easierlit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: easierlit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for easierlit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a90293f29fee7ae4c4eb12cdb5dc9ce120c0125db7581ad49a6f98a8480bc896
MD5 f45d8985adfad0727947d67bb8ace5cd
BLAKE2b-256 6edbdac21eeee26eff2f44eb3c79c7467b7c1ac1708b3f6346841296db4fded5

See more details on using hashes here.

Provenance

The following attestation bundles were made for easierlit-0.2.0-py3-none-any.whl:

Publisher: publish.yml on smturtle2/easierlit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page