apifunc: Modular Pipeline Framework with Dynamic graphs
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
- Clone the repository:
git clone https://github.com/tom-sapletta-com/apifunc.git
- Install the package:
pip install .
Usage
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python cli.py run
python src/apifunc/cli.py run -o my_report.pdf
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:
- Generates a
.protofile defining a gRPC service with aTransformmethod. - Compiles the
.protofile 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:
grpciogrpcio-toolsprotobufjinja2weasyprint
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
Metadata
Release files for apifunc 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apifunc-0.1.2.tar.gz | 26.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apifunc-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / apifunc-0.1.2.tar.gz
| Download URL | apifunc-0.1.2.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be48d24162c76b242d3f6bc3b0ffd10ab6977f1b1695f7da2d031fae66b5a52c
|
|
BLAKE2b-256 checksum How to use checksums |
e7b321823d39d9bfbfaa6342e21bd6903074556dba3a5917fa8f9d5e6f2993bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / apifunc-0.1.2-py3-none-any.whl
| Download URL | apifunc-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f010f020cf071dea2ec5c11b482e048ed9a342a2a0180cb026ea089797ab8f1c
|
|
BLAKE2b-256 checksum How to use checksums |
b8a0f20e99b70ac36d38a6c7185a39a0a5500b0c9e215a959970aedf42dc10d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|