Skip to content

Barca

Run tasks. Cache assets. Manage partitions. Locally or on one server.

Use @asset for a cached result and @task for an action that runs every time. Declare inputs between functions; barca runs their dependencies and reuses unchanged results. Partitions give each customer, date or other key its own cache entry.

Start with barca get and barca run on your machine. Add barca serve when you want a shared run history, schedules and a web UI. --server runs the deployed project’s code there and prints the result here. Getting Started walks through all three: assets, tasks and partitions, then remote execution.

pipeline.py
from barca import asset
@asset()
def raw_data() -> list[dict]:
return [{"x": 1}, {"x": 2}, {"x": 3}]
@asset(inputs={"data": raw_data})
def summary(data: list[dict]) -> dict:
return {"count": len(data), "total": sum(d["x"] for d in data)}
$ barca get pipeline.py
[barca] 2/2 steps | done in 0.0s
Run 51fabebab1c0 | all assets in 0.135s (2 steps, 1 phase)
.barca/artifacts/pipeline.py--summary/....json
{
"count": 3,
"total": 6
}
Terminal window
uv add barca # or: pip install barca

Python 3.12 or later; uv is not required. Getting Started walks through the first run.

Where results live

.barca/ in the project root holds the cache and the run history; git already ignores it. A remote store is this machine’s backup and read-through cache; sharing means a server. --env keeps dev and prod apart.

Inspection commands

barca list, barca status, --dry-run and barca plan show what exists, what is cached and what would run. barca sql queries cached results. All print JSON when piped.

Outside data comes in through a sensor

An asset that reads a file or a bucket in its own body is computed once and then served from cache. Put a @sensor in front of it. See the guide.

Large inputs

An unannotated parquet input is read in full with pandas. Annotate the parameter duckdb.DuckDBPyRelation or pl.LazyFrame to read only what the step uses. See Large inputs.

Many partitions, few changes

A sensor that returns {key: version} feeds partitions_from: each key runs again only when its version changes, out of 200,000 keys. See Only what changed.

get for assets, run for tasks

The target comes first, then files: barca get <asset> <files>, barca run <task> <files>. get uses the cache. A task always runs. See the CLI reference.

Scheduler and server

barca serve runs Schedule("<cron>") nodes on their cron ticks and serves an HTTP API and a web UI. See Scheduling.

The binary parses your Python source and does not import it, so decorators and inputs= have to be written literally. An asset is cached by run hash, which covers its code and its inputs, not the bytes of its result. Architecture describes a run step by step, and Philosophy says what each design choice costs.