JC Etlforge

A minimalist, plugin-driven ETL framework for Python with declarative
pipelines, concurrency, and a first-class CLI.
pip install jc-etlforge
jc-etlforge run pipeline.yaml
jc-etlforge is the pytest of ETL: small, composable, extensible, and
installable from PyPI. It does not try to be Airflow — it tries to replace
the ad-hoc Python script that copies data from one place to another.
Table of contents
- JC Etlforge
- Table of contents
- Why jc-etlforge
- Install
- Quickstart
- How it works
- Layers
- Data flow
- Execution model
- Built-in components
- Sources
- Transformers
- Sinks
- Pipeline config
- Format conversion is just a config choice
- CLI reference
- Plugins
- Where to use it
- Legacy data migration
- SaaS integration
- CI/CD data pipelines
- Spreadsheet cleanup
- Plugin ecosystem
- Design decisions
- Development
- Roadmap
- License
- Author
Why jc-etlforge
Most ETL tools are either too heavy (full platforms with scheduler,
UI, and database) or too ad-hoc (one-off scripts that each reimplement
parsing, retry, logging, and tests).
jc-etlforge sits in the sweet spot: a small, declarative framework
built around four primitives:
- Source — where data comes from (JSON, CSV, positional files, …).
- Transformer — how data is reshaped (regex, rename, filter, …).
- Sink — where data goes (JSON, CSV, positional files, …).
- Pipeline — a chain that wires sources, transformers, and sinks.
Pipelines are declared in YAML or JSON, executed by pluggable engines
(threaded or multiprocessing), and extended through entry-point
plugins — no forks required.
Install
Requires Python 3.10+.
pip install jc-etlforge
Verify:
jc-etlforge --version
jc-etlforge info
For development, see Development.
Quickstart
Create data/in.json:
[
{"id": 1, "name": "Alice", "email": "alice@example.com"},
{"id": 2, "name": "Bob", "email": "bob@example.com"},
{"id": 3, "name": "Carol", "email": "carol@example.com"}
]
Create pipeline.yaml:
name: quickstart
source:
type: JsonSource
path: data/in.json
transformers:
- type: RegexTransformer
field: email
pattern: "@example\\.com$"
replacement: "@example.org"
sink:
type: CsvSink
path: output/out.csv
fields: [id, name, email]
Validate and run:
jc-etlforge validate pipeline.yaml
jc-etlforge run pipeline.yaml
Output:
INFO jc_etlforge: pipeline quickstart starting (executor=thread, workers=1, retries=1)
INFO jc_etlforge: pipeline quickstart finished in 0.001s: {'rows.read': 3, 'rows.written': 3, 'rows.transformed': 3}
pipeline 'quickstart' finished in 0.001s
rows.read: 3
rows.transformed: 3
rows.written: 3
output/out.csv:
id,name,email
1,Alice,alice@example.org
2,Bob,bob@example.org
3,Carol,carol@example.org
That's it. No Python code, no if __name__ == "__main__", no retry
boilerplate.
How it works
Layers
flowchart TB
subgraph CLI["CLI"]
info["info"]
validate["validate"]
run["run"]
plugins["plugins list"]
end
subgraph Config["Config"]
load["load_config\n(YAML/JSON → dict)"]
from_config["Pipeline.from_config\n(dict → Pipeline)"]
end
subgraph Core["Core"]
pipeline["Pipeline\n(Source → Transformer… → Sink)"]
context["PipelineContext\n(logger, metrics, config)"]
executor["Executor\n(thread | process | sequential)"]
retry["with_retry\n(exponential backoff)"]
end
subgraph Components["Built-in components"]
sources["Sources: JsonSource,\nCsvSource, PositionalFileSource"]
transformers["Transformers: RegexTransformer,\nRenameTransformer, FilterTransformer"]
sinks["Sinks: JsonSink,\nCsvSink, PositionalFileSink"]
end
subgraph Plugins["Plugins (entry points)"]
third_party["jc_etlforge.transformers\n(third-party packages)"]
end
info --> Core
validate --> Config
run --> Config
plugins --> Plugins
load --> from_config
from_config --> pipeline
pipeline --> context
pipeline --> executor
executor --> retry
pipeline --> sources
pipeline --> transformers
pipeline --> sinks
from_config -.->|resolve type| Components
from_config -.->|resolve type| Plugins
The CLI is a thin shell: it parses arguments, loads config, and
delegates to the core. The core is engine-agnostic: it wires a
Source, zero or more Transformers, and a Sink, and lets an
Executor decide how to fan out process calls.
Data flow
A pipeline is a lazy stream of dict[str, Any] records. Nothing is
read until the sink pulls; each transformer yields records one at a time.
Memory usage is bounded by the largest single record, not by the input
size.
sequenceDiagram
participant CLI
participant Pipeline
participant Source
participant Transformer
participant Sink
participant Context
CLI->>Pipeline: from_config(dict)
CLI->>Context: __enter__()
CLI->>Pipeline: run(ctx, executor, workers, retries)
Pipeline->>Source: read(ctx)
loop for each record
Source-->>Pipeline: record
Pipeline->>Transformer: process(record, ctx)
Transformer-->>Pipeline: transformed | None | list
Pipeline->>Context: record("rows.transformed")
end
Pipeline->>Sink: write(record, ctx)
Sink-->>Pipeline: None
Pipeline->>Context: record("rows.written")
CLI->>Context: __exit__()
CLI-->>CLI: print metrics
Execution model
Pipeline.run accepts three knobs:
| Knob |
Default |
Effect |
executor |
"thread" |
"thread" uses ThreadPoolExecutor; "process" uses ProcessPoolExecutor. |
max_workers |
1 |
1 runs sequentially (no pool overhead); >1 fans out transformer.process across workers. |
retries |
1 |
Total attempts per record when process raises. 1 means "no retry". |
# Sequential (default)
jc-etlforge run pipeline.yaml
# 4 threads (I/O-bound transformers)
jc-etlforge run pipeline.yaml --workers 4
# 4 processes (CPU-bound transformers)
jc-etlforge run pipeline.yaml --executor process --workers 4
# Retry up to 3 times with 0.5s base backoff
jc-etlforge run pipeline.yaml --retries 3 --retry-backoff 0.5
Metrics (rows.read, rows.transformed, rows.written, rows.filtered,
rows.failed) are counted in the parent process, so they are accurate
even with --executor process.
Built-in components
Sources
| Class |
Reads |
Args |
JsonSource |
JSON array or wrapped object |
path, records_key, encoding |
CsvSource |
CSV with header |
path, delimiter, encoding |
PositionalFileSource |
Fixed-width text |
path, layout, encoding, skip_blank_lines |
Transformers
| Class |
Does |
Args |
RegexTransformer |
Regex substitution on one or more fields |
field, pattern, replacement, flags, missing |
RenameTransformer |
Rename fields via mapping |
mapping |
FilterTransformer |
Keep records matching a predicate |
field, op (eq/ne/in/not_in/regex/not_regex), value |
Sinks
| Class |
Writes |
Args |
JsonSink |
JSON array (pretty-printed) |
path, encoding |
CsvSink |
CSV with header |
path, fields, delimiter, encoding |
PositionalFileSink |
Fixed-width text |
path, layout, encoding |
PositionalFileSink accepts a layout of either plain (start, end)
tuples (space-padded, left-aligned) or FieldSpec(start, end, align, fill)
for zero-padding and right-alignment:
layout:
id: {start: 0, end: 5, align: right, fill: "0"} # → "00001"
name: {start: 5, end: 15, align: left, fill: " "} # → "Alice "
Pipeline config
A pipeline is a YAML or JSON file with source, optional
transformers, and sink. Each is a mapping with a type key
(resolved against built-in components, then plugins) and constructor
kwargs.
name: my-pipeline # optional, defaults to "pipeline"
source:
type: JsonSource
path: data/in.json
transformers:
- type: FilterTransformer
field: status
op: eq
value: active
- type: RenameTransformer
mapping:
full_name: name
sink:
type: CsvSink
path: output/out.csv
fields: [id, name, email]
jc-etlforge validate pipeline.yaml parses and validates the config
without executing — useful in CI to catch bad configs before they run.
Format conversion is just a config choice
Because every component speaks dict[str, Any], any combination works:
| From → To |
Source |
Transformers |
Sink |
| JSON → CSV |
JsonSource |
(optional) |
CsvSink |
| CSV → JSON |
CsvSource |
(optional) |
JsonSink |
| CSV → CSV (clean) |
CsvSource |
Filter/Rename/Regex |
CsvSink |
| JSON → JSON (clean) |
JsonSource |
Filter/Rename/Regex |
JsonSink |
| Positional → CSV |
PositionalFileSource |
(optional) |
CsvSink |
| CSV → Positional |
CsvSource |
(optional) |
PositionalFileSink |
Note on types: CsvSource reads every value as a string (that is
what csv.DictReader does). If you need id as an integer in the
output JSON, add a CastTransformer (see
examples/plugins/).
CLI reference
jc-etlforge [OPTIONS] COMMAND [ARGS]...
Commands:
info Print version and environment info.
run Execute a pipeline from a YAML/JSON config.
validate Validate a config without executing it.
plugins list List transformers discovered via entry points.
Exit codes
| Code |
Meaning |
| 0 |
Success |
| 1 |
Unmapped exception (bug — please report) |
| 2 |
CLI usage error (reserved by click) |
| 3 |
ConfigurationError — bad config file or unknown component |
| 4 |
PipelineError / ExecutionError — pipeline failed |
| 5 |
PluginError — plugin failed to load or validate |
Scripts can branch on these:
jc-etlforge run pipeline.yaml
case $? in
0) echo "ok" ;;
3) echo "fix your config" >&2; exit 1 ;;
4) echo "pipeline failed" >&2; exit 2 ;;
*) echo "unexpected: $?" >&2; exit 3 ;;
esac
Plugins
Third parties extend jc-etlforge by publishing a package that declares
an entry point under jc_etlforge.transformers:
[project.entry-points."jc_etlforge.transformers"]
titlecase = "my_pkg:TitleCaseTransformer"
After pip install my-pkg, the transformer is available by name in any
pipeline config:
transformers:
- type: titlecase
field: name
List discovered plugins:
jc-etlforge plugins list
See examples/plugins/ for a full working example
(TitleCaseTransformer and CastTransformer).
Where to use it
Legacy data migration
flowchart LR
mainframe["Mainframe\n(EBCDIC, fixed-width)"] --> src["PositionalFileSource"]
src --> regex["RegexTransformer\n(trim padding)"]
regex --> sink["JsonSink / CsvSink"]
sink --> cloud["Cloud warehouse"]
A 30-year-old Cobol export becomes a versioned pipeline.yaml per layout,
testable with jc-etlforge validate in CI.
SaaS integration
flowchart LR
stripe["Stripe API"] --> p1["Plugin: StripeSource"]
zendesk["Zendesk API"] --> p2["Plugin: ZendeskSource"]
p1 --> merge["Merge / filter"]
p2 --> merge
merge --> sink["CsvSink / JsonSink"]
sink --> bi["BI dashboard"]
Two 30-line plugins + one YAML file. Runs on a $5/month VPS on a cron.
CI/CD data pipelines
flowchart LR
cron["GitHub Actions\n(scheduled)"] --> validate["jc-etlforge validate"]
validate -->|valid| run["jc-etlforge run"]
validate -->|invalid| fail["fail the build"]
run --> s3["S3 (CSV)"] --> filter["FilterTransformer"] --> pg["Postgres"]
validate in CI catches broken configs before the cron runs;
--executor process uses all cores of the runner.
Spreadsheet cleanup
flowchart LR
xlsx["clientes.xlsx\n(exported CSV)"] --> src["CsvSource"]
src --> filter["FilterTransformer\n(valid CPF)"]
filter --> rename["RenameTransformer\n(standard columns)"]
rename --> regex["RegexTransformer\n(strip phone)"]
regex --> sink["CsvSink"]
sink --> clean["clientes_limpos.csv"]
The monthly spreadsheet cleanup becomes a reusable YAML file, run in
seconds instead of hours.
Plugin ecosystem
flowchart TB
core["jc-etlforge (core)"]
core --> salesforce["jc-etlforge-salesforce"]
core --> snowflake["jc-etlforge-snowflake"]
core --> kafka["jc-etlforge-kafka"]
core --> excel["jc-etlforge-excel"]
The same model that made pytest and mkdocs ecosystems: a small core
plus many focused extensions.
Design decisions
Architectural decisions are recorded as
ADRs:
| ID |
Decision |
| 0001 |
Use modern typing and Python 3.10+ |
| 0002 |
PipelineContext and metrics |
| 0003 |
Executor abstraction and pickling |
| 0004 |
Plugin system via entry points |
| 0005 |
Config format and exit codes |