Metadata-Version: 2.4
Name: laktory
Version: 0.11.10
Summary: An ETL and DataOps framework for building a lakehouse
Project-URL: Homepage, https://github.com/okube-ai/laktory
Project-URL: Documentation, https://www.laktory.ai
Project-URL: Repository, https://github.com/okube-ai/laktory
Project-URL: Bug Tracker, https://github.com/opencubes-ai/laktory/issues
Author-email: Olivier Soucy <olivier.soucy@okube.ai>
License: MIT License
        
        Copyright (c) 2023 okube
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE.md
Keywords: apache-spark,data-pipeline,dataframes,etl,infrastructure-as-code,polars,python,sql
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pydantic :: 2
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: inflect
Requires-Dist: narwhals>=1.46
Requires-Dist: networkx
Requires-Dist: planck>=0.0.8
Requires-Dist: platformdirs
Requires-Dist: prompt-toolkit
Requires-Dist: pydantic-settings
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml
Requires-Dist: sqlglot
Requires-Dist: sqlglotc
Requires-Dist: typer
Requires-Dist: tzdata; sys_platform == 'win32'
Provides-Extra: airflow
Requires-Dist: apache-airflow; extra == 'airflow'
Requires-Dist: graphviz; extra == 'airflow'
Provides-Extra: databricks
Requires-Dist: databricks-bundles; extra == 'databricks'
Requires-Dist: databricks-sdk; extra == 'databricks'
Provides-Extra: dev
Requires-Dist: flit; extra == 'dev'
Requires-Dist: griffe-fieldz; extra == 'dev'
Requires-Dist: mkdocs-material<10,>=9; extra == 'dev'
Requires-Dist: mkdocs-video; extra == 'dev'
Requires-Dist: mkdocs<2,>=1.6; extra == 'dev'
Requires-Dist: mkdocstrings[python]; extra == 'dev'
Requires-Dist: pandas; extra == 'dev'
Requires-Dist: plotly; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pygments<2.20; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-examples; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: yfinance; extra == 'dev'
Provides-Extra: polars
Requires-Dist: deltalake; extra == 'polars'
Requires-Dist: polars<1.32.1; extra == 'polars'
Requires-Dist: sqlparse; extra == 'polars'
Provides-Extra: pyspark
Requires-Dist: delta-spark; extra == 'pyspark'
Requires-Dist: pyarrow; extra == 'pyspark'
Requires-Dist: pyspark[connect]; extra == 'pyspark'
Requires-Dist: setuptools; (python_version >= '3.12') and extra == 'pyspark'
Description-Content-Type: text/markdown

# Laktory

[![pypi](https://img.shields.io/pypi/v/laktory.svg)](https://pypi.org/project/laktory/)
[![test](https://github.com/okube-ai/laktory/actions/workflows/test.yml/badge.svg)](https://github.com/okube-ai/laktory/actions/workflows/test.yml)
[![downloads](https://static.pepy.tech/badge/laktory/month)](https://pepy.tech/project/laktory)
[![versions](https://img.shields.io/pypi/pyversions/laktory.svg)](https://github.com/okube-ai/laktory)
[![license](https://img.shields.io/github/license/okube-ai/laktory.svg)](https://github.com/okube-ai/laktory/blob/main/LICENSE)

An open-source DataOps and dataframe-centric ETL framework for building lakehouses.
Use it standalone or extend your existing DABs setup with it.

<img src="docs/images/logos/laktory_logo_sg.png" alt="laktory logo" width="85"/>

Laktory is an all-in-one solution for defining both data transformations and Databricks
resources. Imagine if Declarative Automation Bundles (DAB) supported any Databricks resources
and offered a declarative approach to data transformations, that's essentially
Laktory.

Deploy it standalone as your full Databricks DataOps platform, or add it alongside
your existing DAB setup to manage pipeline definitions
and the resources DAB doesn't cover.

This open-source framework streamlines the creation, deployment, and execution
of data pipelines while adhering to essential DevOps practices such as version
control, code reviews, and CI/CD integration. Powered by Narwhals, Laktory
enables seamless transitions between Apache Spark, Polars, and other frameworks
to perform data transformations reliably and at scale. Its modular and flexible
design allows you to effortlessly combine SQL statements with DataFrame
operations, reducing complexity and enhancing productivity.

<img src="docs/images/diagrams/laktory_diagram.png" alt="what is laktory" width="800"/>

Since Laktory pipelines are built on top of Narwhals, they can run in
any environment that supports Python, from your local machine to a Kubernetes 
cluster. Pipelines can be orchestrated using tools like Apache Airflow or
deployed directly as Databricks Jobs or
[Declarative Pipelines](https://www.databricks.com/product/data-engineering/lakeflow-declarative-pipelines),
offering both flexible and fully managed execution options.

But Laktory goes beyond data pipelines. It empowers you to define and deploy your entire
Databricks data platform, from Unity Catalog and access grants to compute and quality
monitoring. This empowers your data team to take full ownership of the solution,
eliminating the need to juggle multiple technologies.

No more splitting ownership between Terraform for infrastructure and DAB for
workflows. With Laktory, the team that builds the pipelines can own the stack
end to end.

<img src="docs/images/diagrams/why_simplicity.png" alt="dataops" width="500"/>

## Help
See [documentation](https://www.laktory.ai/) for more details.

## Installation
Install using 
```commandline
pip install laktory
```

For more installation options,
see the [Install](https://www.laktory.ai/install/) section in the documentation.

## A Basic Example
```py
from laktory import models


node_brz = models.PipelineNode(
    name="brz_stock_prices",
    source={
        "format": "PARQUET",
        "path": "./data/brz_stock_prices/"
    },
    transformer={
        "nodes": []
    }
)

node_slv = models.PipelineNode(
    name="slv_stock_prices",
    source={
        "node_name": "brz_stock_prices"
    },
    sinks=[{
        "path": "./data/slv_stock_prices",
        "mode": "OVERWRITE",
        "format": "PARQUET",
    }],
    transformer={
        "nodes": [
            
            # SQL Transformation
            {
                "expr": """
                    SELECT
                      data.created_at AS created_at,
                      data.symbol AS symbol,
                      data.open AS open,
                      data.close AS close,
                      data.high AS high,
                      data.low AS low,
                      data.volume AS volume
                    FROM
                      {df}
                """   
            },
            
            # Spark Transformation
            {
                "func_name": "drop_duplicates",
                "func_kwargs": {
                    "subset": ["created_at", "symbol"]
                }
            },
        ]
    }
)

pipeline = models.Pipeline(
    name="stock_prices",
    nodes=[node_brz, node_slv],
)

pipeline.execute(spark=spark)
```

To get started with a more useful example, jump into the [Quickstart](https://www.laktory.ai/quickstart/).

## Get Involved
Laktory is growing rapidly, and we'd love for you to be part of our journey! Here's how 
you can get involved:
- **Join the Community**: Connect with fellow Laktory users and contributors on our [Slack](http://okube.slack.com/). Share ideas, ask questions, and collaborate!
- **Suggest Features or Report Issues**: Have an idea for a new feature or encountering an issue? Let us know on [GitHub Issues](https://github.com/okube-ai/laktory/issues). Your feedback helps shape the future of Laktory!
- **Contribute to Laktory**: Check out our [contributing guide](CONTRIBUTING.md) to learn how you can tackle issues and add value to the project.

## A Lakehouse DataOps Template
A comprehensive template on how to deploy a lakehouse as code using Laktory is maintained here:
https://github.com/okube-ai/lakehouse-as-code

In this template, 4 stacks are used to:
- `{cloud_provider}_infra`: Deploy the required resources on your cloud provider
- `unity-catalog`: Setup users, groups, catalogs, schemas and manage grants
- `workspace`: Setup secrets, clusters and warehouses and common files/notebooks
- `workflows`: The data workflows to build your lakehouse

## Okube Company
<img src="docs/images/logos/okube_logo.png" alt="okube logo" width="85"/>

[Okube](https://www.okube.ai) is dedicated to building open source frameworks, known as the *kubes*, empowering businesses to build, deploy and operate highly scalable data platforms and AI models.

