# gengine
[![PyPI - Version](https://img.shields.io/pypi/v/gengine.svg)](https://pypi.org/project/gengine)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gengine.svg)](https://pypi.org/project/gengine)
-----
## Table of Contents
- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
## About
*gengine* (short for *generator engine*) is a pipeline or workflow engine for iterating over generators within a pipe and passing the output to the following generators.
This makes it a perfect fit for pipeline oriented approaches where you don't want to write the iteration logic manually.
## Installation
```console
pip install gengine
```
## Usage
From a technical perspective, a gengine pipeline is just an ordered list of callables. Each callable implements a generator pattern (`yield`) or simply returns an output (`return`).
*gengine* iterates over **all** outputs of **each callable** in the list and makes sure that every output is forwarded through the whole pipeline.
`NoneType` is ignored and not forwarded (this is the reason why it is mandatory to pass an input to `GenGine.run`, even if the first callable doesn't use it).
Each callable must accept exactly one parameter.
```python
from gengine import GenGine
def my_gen(_inp):
for j in range(10):
yield j
def my_add(inp):
return inp+2
def my_mul(inp):
for i in range(3):
yield inp*i
def my_filter(inp):
if inp%2 == 0:
return None
else:
return inp
g = GenGine([my_gen, my_add, my_mul, my_filter])
for el in g.run(1):
print(el)
```
## License
`gengine` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "gengine",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "data, engine, generator, pipeline, stream, workflow",
"author": null,
"author_email": "m-birke <wesci@web.de>",
"download_url": null,
"platform": null,
"description": "# gengine\n\n[![PyPI - Version](https://img.shields.io/pypi/v/gengine.svg)](https://pypi.org/project/gengine)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gengine.svg)](https://pypi.org/project/gengine)\n\n-----\n\n## Table of Contents\n\n- [About](#about)\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n\n## About\n\n*gengine* (short for *generator engine*) is a pipeline or workflow engine for iterating over generators within a pipe and passing the output to the following generators.\n\nThis makes it a perfect fit for pipeline oriented approaches where you don't want to write the iteration logic manually.\n\n## Installation\n\n```console\npip install gengine\n```\n\n## Usage\n\nFrom a technical perspective, a gengine pipeline is just an ordered list of callables. Each callable implements a generator pattern (`yield`) or simply returns an output (`return`).\n*gengine* iterates over **all** outputs of **each callable** in the list and makes sure that every output is forwarded through the whole pipeline.\n`NoneType` is ignored and not forwarded (this is the reason why it is mandatory to pass an input to `GenGine.run`, even if the first callable doesn't use it).\nEach callable must accept exactly one parameter.\n\n```python\nfrom gengine import GenGine\n\ndef my_gen(_inp):\n for j in range(10):\n yield j\n\ndef my_add(inp):\n return inp+2\n\ndef my_mul(inp):\n for i in range(3):\n yield inp*i\n\ndef my_filter(inp):\n if inp%2 == 0:\n return None\n else:\n return inp\n\ng = GenGine([my_gen, my_add, my_mul, my_filter])\n\nfor el in g.run(1):\n print(el)\n```\n\n## License\n\n`gengine` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": "Engine for piping generators",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/m-birke/gengine#readme",
"Issues": "https://github.com/m-birke/gengine/issues",
"Source": "https://github.com/m-birke/gengine"
},
"split_keywords": [
"data",
" engine",
" generator",
" pipeline",
" stream",
" workflow"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2462b76ff6eac9a144e844e0b2d9bd193a0915b68c1fe303d57c673c9a0b37bd",
"md5": "ab7f53cd6428ea6c42028467c2938a7a",
"sha256": "2eb1553daaf30d06238275b655cc172639d1c628dda6ba346db5273688316d6b"
},
"downloads": -1,
"filename": "gengine-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ab7f53cd6428ea6c42028467c2938a7a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3727,
"upload_time": "2024-09-16T15:32:41",
"upload_time_iso_8601": "2024-09-16T15:32:41.628686Z",
"url": "https://files.pythonhosted.org/packages/24/62/b76ff6eac9a144e844e0b2d9bd193a0915b68c1fe303d57c673c9a0b37bd/gengine-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-16 15:32:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "m-birke",
"github_project": "gengine#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "gengine"
}