Carabao
+:
- *-
-* +--
-* *=:
-=* +=+-
-+* +==*-
++=* **=+-
*==*+ -**==*-
-***=*++ -*=**=**-%
%-****=*===----------#*%*##+%#@#**-*---------===**+=-%-#
**=-***-=*==*==--****%#%%@*@@%#*-----+*=++%++++%%*
*%%%#%####%##%*#%%=##@++%@%%######%%%%#%@
+ @%@@@@##%#=@#@@+++@@%
--+++++##%@%#=@@+@@%%@#@#++++=%
@+*@@@@@@##@##*=**+*@%%%@#@+@@#@++%
#* *#**##+#%%%*@ %%%%++++#+
*+****+#%%%*@
**=*==+#%##*
*=*=+*#%#*
#=*****#*
#@=***#@##
%%=%%%#=#%#
####%%%#
A Python library for building robust publisher-subscriber (pub/sub) frameworks with built-in lanes for common tasks.
Features
- Core framework for managing pub/sub systems based on l2l (lane2lane)
- Live RAM / CPU / network stats in the dev UI status bar (when
psutilis installed) - Automatic configuration management with settings system
- Error handling with custom error handlers
- Clean shutdown with exit handlers
- Command-line interface for management, including interactive selection
- Support for multiple database connections (MongoDB, Redis, Elasticsearch, PostgreSQL)
- Async database hubs for async lanes —
amongo(pymongoAsyncMongoClient) andaredis(redis.asyncio) - Development and production mode support
- Test mode for safe testing in production environments
Installation
pip install carabao
The interactive developer UI (the moo dev selector + live visualizer) is
optional — it ships in the standard extra (à la fastapi[standard]):
pip install "carabao[standard]"
Without the extra, the core runtime (moo run, moo dev <lane>) works fully;
only the interactive screens require it (you'll get a clear message prompting
the install if you open them without it).
The database hubs (MongoDB, Redis, Elasticsearch, PostgreSQL) need their drivers
installed separately — e.g. pip install "fun-things[mongo,redis]" psycopg2-binary.
Requirements
Core: fun-things, lazy-main, python-dotenv, typing-extensions, typer,
lane2lane.
standard extra (interactive UI): textual, textual-slider.
Claude Code skill
This repo ships a Claude Code skill that
teaches Claude how to use carabao and its underlying lane2lane (l2l)
pipeline engine — the moo CLI, lanes, priorities, Forms, settings, and the
database hubs. Once installed, Claude applies it automatically when you work on
a carabao or lane2lane project.
The skill is distributed as a Claude Code plugin (not via pip). Run these
commands inside Claude Code (they are slash commands, not shell commands):
/plugin marketplace add Talisik/carabao
/plugin install carabao@carabao
The skill activates automatically based on the project you're in. To invoke it
manually, run /carabao:carabao.
Usage
Basic Usage
The framework is started using the CLI commands:
# For development mode
moo dev [queue_name]
# For production mode
moo run
No import statement is needed to start the framework.
Forms
A lane can declare a Form — typed inputs the moo dev selector prompts for
before running. Define an inner Form class with annotated attributes (or
Field(...) for a bounded numeric slider), then read the values anywhere via
the global F:
from l2l import Lane
from carabao import F, Field
class Main(Lane):
class Form:
source: str = "synthetic" # text input
batch_size: int = 100 # number input
threshold: float = 0.5
dry_run: bool = False # checkbox
workers = Field(cast=int, default=4, min_value=1, max_value=8, step=1) # slider
@classmethod
def primary(cls) -> bool:
return True
def process(self, value):
if F.dry_run:
...
print(F.source, F.batch_size, F.workers)
- Plain annotations become typed inputs:
str→ text,int/float→ number,bool→ checkbox. Field(cast=int, min_value=…, max_value=…, step=…)renders a slider.- Read values with
F.<name>(orF["<name>"]). The selector remembers the last-entered values per lane. - Forms are optional — a lane without one just runs.
Environment Variables
Carabao uses the following environment variables:
QUEUE_NAME: (Required) Name of the queue to consumeCARABAO_AUTO_INITIALIZE: Controls automatic initializationCARABAO_AUTO_START: Controls automatic startingCARABAO_START_WITH_ERROR: Whether to start even if errors occurredSINGLE_RUN: Run once then exit ifTrueTESTING: Enable debug logging ifTrueCARABAO_LOG_MAX_LINES: Dev UI log buffer size (default10000)CARABAO_LOG_PAGE_SIZE: Dev UI log lines rendered per page (default200)
Environment Files
Carabao supports environment variables loaded from .env files using python-dotenv:
.env.development: Used when running in development mode (moo dev).env.release: Used when running in production mode (moo run).env: Used as a fallback if neither of the above files exists
When initializing a new project with moo init, these files are automatically created.
The framework prioritizes environment variables in the following order:
- Variables defined in the system environment
- Variables defined in the appropriate .env file
- Default values defined in settings
This makes it easy to maintain different configurations for development, testing, and production environments without changing code.
Settings System
Carabao uses a centralized Settings system for configuration management. The Settings class provides a unified interface for accessing configuration values throughout the application.
Setting Up settings.py
A typical settings.py file inherits from the base Settings class:
from carabao import Settings as S
class Settings(S):
# Directory where the lane modules are stored
LANE_DIRECTORIES = [
"lanes",
]
# Whether to run the pipeline once and exit
SINGLE_RUN = False
# Minimum and maximum sleep times between runs (in seconds)
SLEEP_MIN = 1.0
SLEEP_MAX = 3.0
# Whether to exit when processing is finished
EXIT_ON_FINISH = False
# Delay before exiting (in seconds)
EXIT_DELAY = 0.0
# Number of parallel processes to use
PROCESSES = 1
# Whether to deploy safely in production
DEPLOY_SAFELY = True
# Custom error handler function
@classmethod
def error_handler(cls, error: Exception) -> None:
"""
Custom error handler for the application.
Args:
error: The exception that was raised.
"""
print(f"An error occurred: {error}")
@classmethod
def before_start(cls) -> None:
"""
Hook method called before framework startup.
"""
# Perform any necessary initialization
pass
When you run moo init, this file is automatically created for you in the appropriate location.
Settings Configuration
-
carabao.cfg File: The framework uses a configuration file to locate your settings module:
[directories] settings = src.settings # or path.to.your.settings -
Accessing Settings in Code: To use these settings in your code:
from carabao.settings import Settings settings = Settings.get() value = settings.value_of("LANE_DIRECTORIES")
-
Available Settings: Common settings include:
LANE_DIRECTORIES: List of directories to search for lane definitionsSINGLE_RUN: Whether to run lanes once or continuouslySLEEP_MIN,SLEEP_MAX: Minimum and maximum sleep times between runsEXIT_ON_FINISH: Whether to exit after finishing processingEXIT_DELAY: Delay before exitingPROCESSES: Number of parallel processes to useDEPLOY_SAFELY: Whether to enforce production safety settings
You can also define your own custom settings and access them the same way.
-
Overriding Settings: Settings can be overridden by environment variables. For example, if your setting is named
SINGLE_RUN, you can override it by setting theSINGLE_RUNenvironment variable.
CLI Usage
Carabao provides a command-line interface for managing lanes:
# Run in production mode
moo run [queue_name]
# Run in development mode
moo dev [queue_name]
# Initialize a new project
moo init [--skip]
# Create a new lane
moo new [lane_name]
Development UI (moo dev)
Requires the standard extra (pip install "carabao[standard]").
Selector. moo dev (no queue name) opens an interactive screen:
- Lists every available primary lane — both sync (
Lane) and async (AsyncLane). - Shows the selected lane's docstring and a process tree built from its
lanesfield (recursive — sub-lanes appear automatically). - Edits the lane's form fields (if it defines a
Form). - Toggles: 🧪 Test and 📊 UI (the live visualizer; on by default).
- Remembers your last selection.
Enterruns,Escexits.
moo dev <queue_name> skips the selector and runs that lane directly.
Live UI. With the 📊 UI toggle on, running a lane opens a live dashboard.
The left panel has tabs (cycle with q / e):
- Lanes — the full pipeline drawn as a selectable/copyable ASCII tree from
the
lanesfield up front. Each node is dim while pending, then colors as it runs and finishes — green (running) → bright green (done) for active lanes, blue → bright blue for passive lanes, bright red on error; it spins while active, shows its true work time, and a×Nbadge once it has run more than once. Root lanes are ordered by who started first (so passive watchers float to the top). - Env — the loaded
.envfile(s) and the env vars actually read. - Value — the latest value flowing between lanes (type · count · bytes), as pretty JSON.
The log pane captures print(), the l2l logger, loguru, and the
stdlib logging module (including non-propagating loggers):
- selectable text (drag to select, double-click a word, triple-click a line,
Ctrl+Cto copy) - syntax-highlighted JSON, colored tracebacks, and inline markdown
(
**bold**,`code`,*italic*,~~strike~~) - multi-line bodies (JSON, tracebacks) indent under the message column so the pane reads like a table
- optional toggles for the
module:func:lineorigin and the lane that emitted each line; the lane column auto-sizes to the lanes on the page
The bottom bar is a compact control strip:
/reveals a search box (hides again when empty)fswaps in the level filters,dthe display toggles — number keys toggle each item;TRACEis off by default- live RAM / CPU / network (when
psutilis installed) and an elapsed timer
Breakpoints. Call self.breakpoint("label") inside process() to pause the
pipeline (dev-only — a no-op under moo run). The lane shows ⏸, logs at the
PAUSE level, and the timer freezes; inspect the payload in the Value tab,
then press c to continue.
The status bar shows live RAM / CPU / network (when psutil is installed)
and an elapsed timer — Done in <time> (green) or Error: … (red) on
completion. Esc quits (confirms first if still running; the hotkey turns red
once it's safe to exit).
Async lanes are detected automatically and run via asyncio; the core runtime
(moo run) carries no overhead from any of the UI instrumentation.
Development
Creating a New Project
You can quickly initialize a new project with:
moo init
This will set up the necessary directory structure and configuration files.
Creating a New Lane
To create a new lane for processing:
moo new MyLaneName
This will generate a file with proper naming conventions (snake_case for the filename, PascalCase for the class name).
Metadata
Release files for carabao 2.7.3
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 |
|---|---|---|---|---|
| carabao-2.7.3.tar.gz | 67.2 kB | Without provenance | Details for carabao-2.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| carabao-2.7.3-py3-none-any.whl | Python 3 | none | any | Details for carabao-2.7.3-py3-none-any.whl |
Total release size: 141.0 kB
Release files / carabao-2.7.3.tar.gz
| Download URL | carabao-2.7.3.tar.gz |
|---|---|
| Size | 67.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
491b01f80a32cef5076f3a9f6bddd330b6057fcd935af7f888690db9fbcde1f2
|
|
BLAKE2b-256 checksum How to use checksums |
74bc91f27725067dd8eed0a139c4f33acc5eac52b72cac94319b09b4278823fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / carabao-2.7.3-py3-none-any.whl
| Download URL | carabao-2.7.3-py3-none-any.whl |
|---|---|
| Size | 73.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec47b7e8d61072d153021e68e8a8eaf79797a10d9df0e3860b3481c9fe96ab68
|
|
BLAKE2b-256 checksum How to use checksums |
ccb049ffd4843781cb7dd6a5947e42e2bce570697078949a7208c3189cfa795b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for carabao 2.7.3
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.