Metadata-Version: 2.4
Name: sgn
Version: 0.6.0
Summary: A framework to help navigate buffers through a graph. The buffers must flow.
Author-email: Chad Hanna <crh184@psu.edu>, Yun-Jing Huang <yzh5436@psu.edu>, Jameson Rollins <jameson.rollins@ligo.org>, Patrick Godwin <partick.godwin@ligo.org>, James Kennington <jwkennington@psu.edu>
License: MPL-2.0
Project-URL: Homepage, https://git.ligo.org/greg/sgn
Project-URL: Documentation, https://greg.docs.ligo.org/sgn
Project-URL: Issues, https://git.ligo.org/greg/sgn/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: bottle
Requires-Dist: bottle; extra == "bottle"
Provides-Extra: inspect
Requires-Dist: sgn-inspect; extra == "inspect"
Provides-Extra: monitoring
Requires-Dist: psutil; extra == "monitoring"
Provides-Extra: visualize
Requires-Dist: graphviz; extra == "visualize"
Provides-Extra: all
Requires-Dist: sgn[bottle]; extra == "all"
Requires-Dist: sgn[inspect]; extra == "all"
Requires-Dist: sgn[monitoring]; extra == "all"
Requires-Dist: sgn[visualize]; extra == "all"
Provides-Extra: test
Requires-Dist: sgn[all]; extra == "test"
Requires-Dist: numpy; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-markdown-docs; extra == "test"
Provides-Extra: docs
Requires-Dist: mkdocs; extra == "docs"
Requires-Dist: mkdocstrings; extra == "docs"
Requires-Dist: mkdocstrings-python; extra == "docs"
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: mkdocs-gen-files; extra == "docs"
Requires-Dist: mkdocs-literate-nav; extra == "docs"
Requires-Dist: mkdocs-section-index; extra == "docs"
Requires-Dist: pymdown-extensions; extra == "docs"
Provides-Extra: lint
Requires-Dist: black; extra == "lint"
Requires-Dist: flake8; extra == "lint"
Requires-Dist: flake8-bandit; extra == "lint"
Requires-Dist: flake8-black; extra == "lint"
Requires-Dist: flake8-bugbear; extra == "lint"
Requires-Dist: flake8-future-annotations; extra == "lint"
Requires-Dist: flake8-isort; extra == "lint"
Requires-Dist: flake8-logging; extra == "lint"
Requires-Dist: flake8-pyproject; extra == "lint"
Requires-Dist: isort; extra == "lint"
Requires-Dist: mypy; extra == "lint"
Requires-Dist: mypy-extensions; extra == "lint"
Requires-Dist: typing_extensions; extra == "lint"
Provides-Extra: dev
Requires-Dist: sgn[docs]; extra == "dev"
Requires-Dist: sgn[lint]; extra == "dev"
Requires-Dist: sgn[monitoring]; extra == "dev"
Requires-Dist: sgn[test]; extra == "dev"
Dynamic: license-file

<h1 align="center">SGN</h1>

<p align="center">
  <a href="https://git.ligo.org/greg/sgn/-/pipelines/latest">
    <img alt="ci" src="https://git.ligo.org/greg/sgn/badges/main/pipeline.svg" />
  </a>
  <a href="https://git.ligo.org/greg/sgn/-/pipelines/latest">
    <img alt="ci" src="https://git.ligo.org/greg/sgn/badges/main/coverage.svg" />
  </a>
  <a href="https://greg.docs.ligo.org/sgn/">
    <img alt="documentation" src="https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat" />
  </a>
  <a href="https://pypi.org/project/sgn/">
    <img alt="pypi version" src="https://img.shields.io/pypi/v/sgn.svg" />
  </a>
</p>

SGN is a lightweight Python library for building streaming data pipelines.
Connect sources, transforms, and sinks into clear workflows while SGN handles
asynchronous execution under the hood. Zero external dependencies.

## Installation

```bash
pip install sgn
```

## Example

```python
import functools
from sgn import Pipeline, IterSource, CallableTransform, CollectSink

def scale(frame, factor: float):
    return None if frame.data is None else frame.data * factor

src = IterSource(name="src", source_pad_names=["H1"], iters={"H1": [1, 2, 3]})

transform = CallableTransform.from_callable(
    name="t1",
    sink_pad_names=["H1"],
    callable=functools.partial(scale, factor=10),
    output_pad_name="H1",
)

sink = CollectSink(name="snk", sink_pad_names=["H1"])

p = Pipeline()
p.connect(src, transform)
p.connect(transform, sink)
p.run()

assert list(sink.collects["H1"]) == [10, 20, 30]
```

## Documentation

- **[Tutorial](tutorials/first-pipeline.md)** — New to SGN? Build your first pipeline step by step.
- **[User Guide](user/connect-elements.md)** — Solve specific problems: connecting elements, grouping, parallelism, and more.
- **[Background](background/architecture.md)** — Understand how SGN works: execution model, core concepts, and design decisions.
- **[Reference](reference/elements.md)** — Elements and auto-generated API documentation.

## Related Libraries

- [`sgn-ts`](https://git.ligo.org/greg/sgn-ts): TimeSeries utilities for SGN
- [`sgn-ligo`](https://git.ligo.org/greg/sgn-ligo): LSC specific utilities for SGN
