Skip to main content

A Python library for building robust ETL pipelines with declarative stages and data flow management

Project description

stagecraft

A Python library for building robust ETL (Extract, Transform, Load) pipelines with declarative stages and powerful data flow management.

Features

  • Pipeline Architecture: Build complex data pipelines using declarative stages and conditions
  • Type-Safe Variables: Strongly-typed variable system with support for DataFrames, NumPy arrays, and serializable data
  • Memory Management: Built-in memory tracking and optimization for data-intensive workflows
  • Data Sources: Out-of-the-box support for CSV, JSON, and file-based data sources
  • Conditional Execution: Flexible condition system for controlling stage execution
  • Exception Handling: Comprehensive exception handling with custom wrappers
  • Logging: Configurable logging system for pipeline monitoring
  • Utility Functions: Rich set of utility functions for file operations, string manipulation, and more

Installation

pip install stagecraft

Quick Start

from stagecraft import (
    PipelineDefinition,
    PipelineRunner,
    ETLStage,
    DFVar,
)

# Define your pipeline stages
class LoadDataStage(ETLStage):
    def recipe(self, **kwargs):
        # Load your data
        pass

# Create pipeline definition
pipeline = PipelineDefinition(
    name="my_pipeline",
    stages=[LoadDataStage()]
)

# Run the pipeline
runner = PipelineRunner()
result = runner.run(pipeline)

Examples

Check out the examples/ directory for comprehensive, runnable examples:

Each example is self-contained and demonstrates best practices. See the examples/README.md for detailed documentation.

Core Components

Pipeline System

  • PipelineDefinition: Define pipeline structure and stages
  • PipelineRunner: Execute pipelines with context management
  • ETLStage: Base class for creating custom pipeline stages
  • PipelineContext: Manage pipeline state and variables

Variables

  • DFVar: pandas DataFrame variables
  • NDArrayVar: NumPy array variables
  • SVar: Serializable variables for general Python objects

Data Sources

  • CSVSource: Read data from CSV files
  • JSONSource: Read data from JSON files
  • FileSource: Read data from text files

Conditions

  • AlwaysExecute: Unconditional execution
  • AndCondition/OrCondition: Combine multiple conditions
  • ConfigFlagCondition: Execute based on configuration flags
  • VariableExistsCondition: Check variable presence
  • CustomCondition: Define custom execution logic

Utilities

  • File operations: read_file, write_file, append_file
  • CSV operations: read_csv, write_csv, append_csv
  • JSON operations: read_json, write_json, append_json
  • String utilities: camel_to_snake_case, snake_to_camel_case, and more
  • Time utilities: get_timestamp, get_current_date

Requirements

  • Python 3.8+

Development

Install development dependencies:

pip install stagecraft[dev]

Run tests:

pytest

License

Apache-2.0 License - see LICENSE file for details

Contributing

This project is not accepting contributions at this time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stagecraft-0.1.7.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

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

stagecraft-0.1.7-py3-none-any.whl (67.5 kB view details)

Uploaded Python 3

File details

Details for the file stagecraft-0.1.7.tar.gz.

File metadata

  • Download URL: stagecraft-0.1.7.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for stagecraft-0.1.7.tar.gz
Algorithm Hash digest
SHA256 3f2f504495ceeaa5f5f0c9be0dd6ca4030519f58b8d2488f94958a4445112113
MD5 d3a6a08d6cc3f77fda3eb373b56e4c43
BLAKE2b-256 e6e1a3a335d6d6a3be623107cc821a95d18c3fff51f451f607fbb820f935a3b5

See more details on using hashes here.

File details

Details for the file stagecraft-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: stagecraft-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 67.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for stagecraft-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7e037a20a826f5fe15380dc4fed9318efd3aa71770e0df3d96e954e818288c71
MD5 b8037720230e8d92db338d8209fc1c96
BLAKE2b-256 18592662839212e8668acaee86cd4b99778f68f5c9026934916f90ed445a6454

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