Skip to main content

Protocol Interface Functions

Project description

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

  1. Clone the repository:
git clone https://github.com/tom-sapletta-com/apifunc.git
  1. 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:

  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apifunc-0.1.2.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apifunc-0.1.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file apifunc-0.1.2.tar.gz.

File metadata

  • Download URL: apifunc-0.1.2.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for apifunc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 be48d24162c76b242d3f6bc3b0ffd10ab6977f1b1695f7da2d031fae66b5a52c
MD5 6b899bebed543ea7df0785aaa809ce97
BLAKE2b-256 e7b321823d39d9bfbfaa6342e21bd6903074556dba3a5917fa8f9d5e6f2993bf

See more details on using hashes here.

File details

Details for the file apifunc-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: apifunc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for apifunc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f010f020cf071dea2ec5c11b482e048ed9a342a2a0180cb026ea089797ab8f1c
MD5 2ad8f26f6319ac7254fc8aa1e1627593
BLAKE2b-256 b8a0f20e99b70ac36d38a6c7185a39a0a5500b0c9e215a959970aedf42dc10d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page