Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

dags

dags is a Python library for creating executable directed acyclic graphs (DAGs) from interdependent functions. It automatically determines the execution order based on function signatures and enables efficient composition of complex computational pipelines.

Key Features

Quick Example

import dags

def a(x):
    return x ** 2

def b(a):
    return a + 1

def c(a, b):
    return a + b

# Combine functions into one
combined = dags.concatenate_functions(
    functions={"a": a, "b": b, "c": c},
    targets=["c"],
    return_type="dict",
)

result = combined(x=5)  # Returns {"c": 51}

The key is that you can build the combined function at runtime, which allows you to compose a computational pipeline in a way that you do not need to specify in advance, or in a multitude of ways. It has proven very helpful in a framework to solve life cycle models (pylcm) and to model the German taxes and transfers system (ttsim / gettsim).

Installation

pip install dags

Or with conda:

conda install -c conda-forge dags