Skip to main content

Reliable and introspectable async CLI action framework.

Project description

⚔️ Falyx

Falyx is a resilient, introspectable CLI framework for building robust, asynchronous command-line workflows with:

  • ✅ Modular action chaining and rollback
  • 🔁 Built-in retry handling
  • ⚙️ Full lifecycle hooks (before, after, success, error, teardown)
  • 📊 Execution tracing, logging, and introspection
  • 🧙‍♂️ Async-first design with Process support
  • 🧩 Extensible CLI menus and customizable output

Built for developers who value clarity, resilience, and visibility in their terminal workflows.


✨ Why Falyx?

Modern CLI tools deserve the same resilience as production systems. Falyx makes it easy to:

  • Compose workflows using Action, ChainedAction, or ActionGroup
  • Inject the result of one step into the next (last_result)
  • Handle flaky operations with retries and exponential backoff
  • Roll back safely on failure with structured undo logic
  • Add observability with execution timing, result tracking, and hooks
  • Run in both interactive or headless (scriptable) modes
  • Customize output with Rich Tables (grouping, theming, etc.)

🔧 Installation

pip install falyx

Or install from source:

git clone https://github.com/yourname/falyx.git
cd falyx
poetry install

⚡ Quick Example

from falyx import Action, ChainedAction, Menu
from falyx.hooks import RetryHandler, log_success

async def flaky_step():
    import random, asyncio
    await asyncio.sleep(0.2)
    if random.random() < 0.8:
        raise RuntimeError("Random failure!")
    return "ok"

retry = RetryHandler()

step1 = Action("Step 1", flaky_step)
step1.hooks.register("on_error", retry.retry_on_error)

step2 = Action("Step 2", flaky_step)
step2.hooks.register("on_error", retry.retry_on_error)

chain = ChainedAction("My Pipeline", [step1, step2])
chain.hooks.register("on_success", log_success)

menu = Menu(title="🚀 Falyx Demo")
menu.add_command("R", "Run My Pipeline", chain)

if __name__ == "__main__":
    import asyncio
    asyncio.run(menu.run())

📦 Core Features

  • ✅ Async-native Action, ChainedAction, ActionGroup
  • 🔁 Retry policies + exponential backoff
  • ⛓ Rollbacks on chained failures
  • 🎛️ Headless or interactive CLI with argparse and prompt_toolkit
  • 📊 Built-in execution registry, result tracking, and timing
  • 🧠 Supports ProcessAction for CPU-bound workloads
  • 🧩 Custom Table rendering for CLI menu views
  • 🔍 Hook lifecycle: before, on_success, on_error, after, on_teardown

🔍 Execution Trace

[2025-04-14 10:33:22] DEBUG    [Step 1]  flaky_step()
[2025-04-14 10:33:22] INFO     [Step 1] 🔁 Retrying (1/3) in 1.0s...
[2025-04-14 10:33:23] DEBUG    [Step 1]  Success | Result: ok
[2025-04-14 10:33:23] DEBUG    [My Pipeline]  Result: ['ok', 'ok']

🧩 Components

Component Purpose
Action Single async task with hook + result injection support
ChainedAction Sequential task runner with rollback
ActionGroup Parallel runner for independent tasks
ProcessAction CPU-bound task in a separate process (multiprocessing)
Menu CLI runner with toggleable prompt or headless mode
ExecutionContext Captures metadata per execution
HookManager Lifecycle hook registration engine

🧠 Design Philosophy

“Like a phalanx: organized, resilient, and reliable.”

Falyx is designed for developers who don’t just want CLI tools to run — they want them to fail meaningfully, recover gracefully, and log clearly.


🛣️ Roadmap

  • Retry policy DSL (e.g., max_retries=3, backoff="exponential")
  • Metrics export (Prometheus-style)
  • Plugin system for menu extensions
  • Native support for structured logs + log forwarding
  • Web UI for interactive execution history (maybe!)

🧑‍💼 License

MIT — use it, fork it, improve it. Attribution appreciated!


🌐 falyx.dev — reliable actions, resilient flows


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

falyx-0.1.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

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

falyx-0.1.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file falyx-0.1.0.tar.gz.

File metadata

  • Download URL: falyx-0.1.0.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.13.8-arch1-1

File hashes

Hashes for falyx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48f99ee6883573fc279e2cdca2564cada4b4992c093264f5ad13e4fbc2b34cd9
MD5 aed8e01cb05bd143e4a040d5e1924da6
BLAKE2b-256 713c5c34c5e8a8de4f53a5d97725929316adb7a3548290bb533a2297b753273d

See more details on using hashes here.

File details

Details for the file falyx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: falyx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.13.8-arch1-1

File hashes

Hashes for falyx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec62bf8d085fa5869fdf6eba4dd707215c3df8300ddd3c351ad329f19f191ff9
MD5 aa2764ca78c36798c05a87cc17f030a5
BLAKE2b-256 bc17ad83ded42f7bc0dc59e7f3c4e765d8eeddff48244f5f0071871be2b1ec07

See more details on using hashes here.

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