Diform uses dependency injection to orchestrate data-transformation pipelines on-the-fly.
uv add diform
from typing import Any, NewType
import diform
import numpy as np
Tensor = NewType("tensor", np.ndarray)
def subtract_mean(data: Tensor) -> MeanSubtracted[Tensor]:
...
def pca(data: MeanSubtracted[Any]) -> Tensor:
...
container = diform.Container(subtract_mean, pca, dataset=np.array([[1, 2, 3], [4, 5, 6]])
data = container["pca"]()git clone https://github.com/flywhl/diform.gitcd diformuv syncjust test
Science needs humble software tools. Flywheel is an open source collective building simple tools to preserve scientific momentum, inspired by devtools and devops culture. Join our Discord here.
