Metadata-Version: 2.4
Name: apifunc
Version: 0.1.2
Summary: Protocol Interface Functions
Home-page: https://github.com/apifunc/python
Author: apifunc Team
Author-email: info@apifunc.com
License: Apache-2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: websockets>=10.0
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: redis>=4.0.0
Requires-Dist: paho-mqtt>=1.6.0
Requires-Dist: flask>=2.3.0
Requires-Dist: requests>=2.31.0
Requires-Dist: click>=8.1.0
Requires-Dist: colorama>=0.4.6
Requires-Dist: typing-extensions>=4.9.0
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: fastapi>=0.110.0
Requires-Dist: uvicorn>=0.27.0
Requires-Dist: grpcio>=1.62.0
Requires-Dist: grpcio-tools>=1.62.0
Provides-Extra: full
Requires-Dist: grpcio>=1.40.0; extra == "full"
Requires-Dist: paho-mqtt>=1.6.1; extra == "full"
Requires-Dist: pyzmq>=22.2.1; extra == "full"
Requires-Dist: redis>=4.0.2; extra == "full"
Requires-Dist: pika>=1.2.0; extra == "full"
Requires-Dist: graphql-core>=3.2.0; extra == "full"
Requires-Dist: schedule>=1.1.0; extra == "full"
Provides-Extra: dev
Requires-Dist: pytest>=6.2.5; extra == "dev"
Requires-Dist: pytest-cov>=2.12.1; extra == "dev"
Requires-Dist: black>=21.8b0; extra == "dev"
Requires-Dist: isort>=5.9.3; extra == "dev"
Requires-Dist: flake8>=3.9.2; extra == "dev"
Requires-Dist: mypy>=0.910; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# [ apifunc: Modular Pipeline Framework with Dynamic graphs](https://github.com/tom-sapletta-com/apifunc)

+ [python.apifunc.com](http://python.apifunc.com)


RPC Services

## Overview

`apifunc` is a Python framework for building modular data processing pipelines. It allows you to define pipeline components as functions and dynamically generate gRPC services for them. This enables you to create flexible and scalable data processing workflows that can be easily integrated with other systems via gRPC.

## Key Features

*   **Modular Design:** Build pipelines from reusable components.
*   **Dynamic gRPC Generation:** Automatically generate gRPC service definitions and code from Python functions.
*   **Input Validation:** Each component can define its own input validation logic.
*   **Pipeline Orchestration:** Easily define and execute complex pipelines.
*   **Example Components:** Includes example components for JSON to HTML and HTML to PDF conversion.

## Installation

1.  **Clone the repository:**
```bash
git clone https://github.com/tom-sapletta-com/apifunc.git
```
2.  **Install the package:**
```bash
pip install .
```
## Usage

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

   
```bash
python cli.py run
``` 

```bash
python src/apifunc/cli.py run -o my_report.pdf
```

```bash
python src/apifunc/apifunc.py
```

```
pip install coverage
coverage run -m unittest discover -s tests
coverage report -m
python -m unittest discover -s tests
```


```
/home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python -m venv venv
source venv/bin/activate
pip install grpcio grpcio-tools jinja2 weasyprint
python -m unittest tests.test_apifunc
```


To install the required dependencies for testing:
```
pip install jinja2 weasyprint grpcio grpcio-tools
```
    
This will generate `raport.pdf` file.

## Example

The `python/src/apifunc/apifunc.py` file includes a complete example that demonstrates:

*   Converting JSON data to HTML using Jinja2 templates.
*   Converting HTML to PDF using WeasyPrint.
*   Creating a pipeline with these two components.

## gRPC Service Generation

When you create a `DynamicgRPCComponent`, the framework automatically:

1.  Generates a `.proto` file defining a gRPC service with a `Transform` method.
2.  Compiles the `.proto` file into Python code.

The generated files are stored in the `generated_protos` directory.

## Dependencies

The project requires the following Python packages, as listed in `python/requirements.txt`:

*   `grpcio`
*   `grpcio-tools`
*   `protobuf`
*   `jinja2`
*   `weasyprint`

## Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.


