Fragua
Fragua is a lightweight Python framework designed to model, validate, and execute ETL logic in a fully controlled, in-memory environment.
It provides an explicit and minimal execution model where ETL functions, declarative pipelines, and macros are composed and executed deterministically — without schedulers, persistence layers, or external infrastructure.
Fragua intentionally prioritizes clarity over completeness.
Installation
pip install fragua
Purpose
Fragua exists to answer a focused set of development-time questions:
Does this ETL function behave as expected?
Does this declarative pipeline produce the correct result when executed?
Fragua is not a workflow orchestrator nor a production ETL engine.
It is a developer-oriented framework for designing, validating, and reasoning about ETL logic during development.
Quick Start
import fragua as fg
import pandas as pd
# Create environment
env = fg.FraguaEnvironment(name="my_etl")
# Define functions
def extract_data() -> pd.DataFrame:
return pd.read_csv("input.csv")
def transform_data(df: pd.DataFrame) -> pd.DataFrame:
return df.dropna()
def load_data(df: pd.DataFrame) -> None:
df.to_csv("output.csv", index=False)
# Register functions in sets
extract_set = env.registry.create_set("extract")
transform_set = env.registry.create_set("transform")
load_set = env.registry.create_set("load")
env.add_sets(extract_set, transform_set, load_set)
env.add_functions(extract_data, set_name="extract")
env.add_functions(transform_data, set_name="transform")
env.add_functions(load_data, set_name="load")
# Define and execute pipeline
pipeline = {
"name": "simple_etl",
"steps": [
{"set": "extract", "function": "extract_data", "save_as": "raw_data"},
{"set": "transform", "function": "transform_data", "use": "raw_data", "save_as": "clean_data"},
{"set": "load", "function": "load_data", "use": "clean_data"}
]
}
result = env.execute_pipeline(pipeline)
print(result.metadata)
Core Architecture
Fragua is built around a small number of orthogonal, loosely coupled components with strictly defined responsibilities.
1. FraguaSet
A FraguaSet is a logical container for executable definitions.
- Stores named callable ETL functions
- Stores declarative pipeline definitions (
dict[str, Any]) - Groups items by purpose (e.g.
extract,transform,load,pipelines) - Contains no execution logic
- Can optionally expose its functions as step templates
A set is purely an organizational and lookup construct.
2. FraguaRegistry
The registry is a resolution layer.
- Holds multiple
FraguaSetinstances - Resolves functions by
(set_name, function_name)at runtime - Resolves pipeline definitions by name
- Performs no execution or compilation
The registry enables flexible composition without hard-coded dependencies.
3. FraguaStep
A FraguaStep represents a single declarative execution unit.
- References a function by
(set, function) - Declares execution parameters
- Optionally consumes the output of a previous step
- Stores its result under a logical key (
save_as)
A step defines what should happen, not how it happens.
3.1 FraguaStepBuilder
A FraguaStepBuilder is a mutable builder used to construct immutable FraguaStep objects.
- Provides a fluent configuration API
- Supports method chaining (
with_params,with_use,with_save_as) - Produces immutable steps via
.build() - Enables safe and incremental step composition
Builders reduce boilerplate while preserving immutability.
3.2 FraguaStepIndex
A FraguaStepIndex is a template registry for step builders.
- Stores
FraguaStepBuildertemplates by name - Returns fresh builder instances on access
- Is populated automatically from
FraguaSetdefinitions - Is consumed exclusively by macros
This enables reusable step patterns without implicit behavior.
4. Declarative Pipelines
Pipelines in Fragua are pure declarative definitions, represented as dictionaries.
{
"name": "daily_sales",
"steps": [
{"set": "extract", "function": "read_csv"},
{"set": "transform", "function": "clean_data"},
{"set": "load", "function": "write_db"},
]
}
Key characteristics:
- Pipelines are editable, replaceable, and updateable
- They contain no runtime state
- They are compiled into
FraguaPipelineobjects only at execution time - Compilation expands macros and validates dependencies
Runtime pipelines are ephemeral and never persisted.
5. FraguaPipeline (Runtime Artifact)
A FraguaPipeline is a compiled execution plan.
- Contains an ordered list of
FraguaStep - Is produced from a declarative definition
- Is executed by the agent
- Is discarded after execution
It exists only at runtime.
6. FraguaAgent
The agent is a stateless execution primitive.
- Receives a compiled pipeline
- Resolves functions via the registry
- Executes steps sequentially
- Produces a
FraguaBoxwith results
The agent holds no state between runs.
7. FraguaWarehouse
The warehouse is an in-memory result store.
- Stores execution outputs
- Indexed by
save_as - Intended for inspection, debugging, and assertions
The warehouse exists only during runtime.
8. FraguaEnvironment
The environment is the orchestration boundary of Fragua.
It owns exactly one:
FraguaRegistryFraguaAgentFraguaWarehouseFraguaStepIndex
It provides high-level APIs to:
- Create and register sets
- Register functions and pipeline definitions
- Automatically index step builders from sets
- Compile declarative pipelines (with macro expansion)
- Execute pipelines from multiple representations
- Update or replace pipeline definitions
- Inspect execution results
The environment enables structure without enforcing it.
Macros and Step Composition
Macros (e.g. transform_chain) expand into multiple steps automatically.
- Macros consume only
FraguaStepBuildertemplates from theStepIndex - Expansion happens at compile time
- The final macro step may expose a
save_askey for downstream use
Macros are declarative and deterministic.
Execution Entry Point
Fragua exposes a single execution API:
env.execute_pipeline(pipeline)
Supported inputs:
FraguaPipeline→ executed directlystr→ resolved from registry, compiled, then executeddict→ compiled inline, then executed
This unifies execution flow and removes ambiguity.
Typical Workflow
- Create an environment
- Define one or more
FraguaSet - Register functions into sets
- Register declarative pipeline definitions
- Optionally update or replace pipeline definitions
- Execute pipelines
- Inspect results from the warehouse
Design Principles
- Minimalism — no feature without a clear purpose
- Explicitness — no hidden behavior
- Single Responsibility — each component does one thing
- Declarative First — definitions before execution
- Runtime Only — no persistence, no side effects
What Fragua Is Not
Fragua is not:
- A scheduler
- A workflow orchestrator
- A production ETL engine
- A data platform
Fragua is a development framework for ETL design, validation, and reasoning.
Key Features
- 🔧 Declarative Pipeline Definition: Define ETL pipelines as simple dictionaries
- ⚡ In-Memory Execution: Fast, stateless execution without external dependencies
- 🏗️ Component-Based Architecture: Modular design with clear separation of concerns
- 🧪 Development-Focused: Perfect for testing and validating ETL logic before production
- 🔍 Macro Support: Automate common patterns with expandable macros
- 📊 Result Inspection: Built-in result storage for debugging and analysis
Examples
Using Transform Chains
# Define a transformation chain with multiple steps
pipeline = {
"name": "data_cleaning",
"steps": [
{"set": "extract", "function": "read_excel", "save_as": "raw_data"},
{
"macro": "transform_chain",
"set": "transform",
"step_prefix": "clean",
"start_from": "raw_data",
"save_as": "clean_data",
"steps": [
{"function": "remove_duplicates"},
{"function": "fill_missing_values"},
{"function": "standardize_columns"}
]
},
{"set": "load", "function": "write_csv", "use": "clean_data"}
]
}
Programmatic Pipeline Building
# Build pipelines using the fluent API
pipeline = (
env.create_pipeline("excel_pipeline")
.add(extract_step)
.add(*transform_steps)
.add(load_step)
.build()
)
Requirements
- Python 3.10+
- pandas
License
MIT License
Metadata
Release files for fragua 1.7.0
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 | |
|---|---|---|---|---|
| fragua-1.7.0.tar.gz | 22.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fragua-1.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.9 kB
Release files / fragua-1.7.0.tar.gz
| Download URL | fragua-1.7.0.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
789af678cdb1b92265d5f4b67bab6565d06a723a0ac9d93f5564d09c9f7a2220
|
|
BLAKE2b-256 checksum How to use checksums |
80766939842c6d6e8b6201619bab6b3a20ddf40403627eda5d6c39e08059e08d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / fragua-1.7.0-py3-none-any.whl
| Download URL | fragua-1.7.0-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa32fe6c11cde2c60886984a0e04b9c36905115629266183f6d1bdde8c9c099f
|
|
BLAKE2b-256 checksum How to use checksums |
a960062f4bfa103e3e222c9af191da28bdebd70b3bac6080219f88228b13f709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for fragua 1.7.0
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.