Async service toolchain
Project description
PyFlowApi
PyFlowApi is a framework for creating REST API services, powered by PyFreeFlow and FastAPI. It allows you to configure and expose endpoints through a simple YAML configuration file, without writing additional code.
Definition
The YAML configuration requires two main keys:
- pyfreeflow: defines which non-preloaded pyfreeflow extensions should be loaded.
- api: defines the list of API endpoints to be exposed.
API configuration
Each API entry under the api key supports the following parameters:
- min_size: minimum request size.
- max_size: maximum request size.
- methods: list of allowed HTTP methods (GET, POST).
- route: endpoint route.
- version (optional): API version, defaults to 0.0.
- pipeline: the pyfreeflow pipeline definition to be executed when the endpoint is called. (See pyfreeflow documentation.)
Endpoint composition
Each endpoint is automatically exposed following the rule:
v<X>/<Y>/<route>
Where:
- X = major version number
- Y = minor version number
- route = the configured route string
Example:
v1/0/sleep
Example configuration
pyfreeflow:
ext:
- pyfreeflow.ext.sleep_operator
api:
- max_size: 128
methods:
- GET
- POST
min_size: 4
pipeline:
digraph:
- I -> A0
- A0 -> A1
- A1 -> A2
- A2 -> O
name: sleep
node:
- config:
transformer: |2
data.I = true
state.I = true
name: I
type: DataTransformer
version: '1.0'
- config:
transformer: |2
data.A = true
state.A = 0
name: A0
type: DataTransformer
version: '1.0'
- config:
sleep_min: 0
sleep_max: 2
name: A1
type: RandomSleepOperator
version: '1.0'
- config:
transformer: |2
data.A = true
state.A = state.A + 1
name: A2
type: DataTransformer
version: '1.0'
- config:
transformer: |2
local result
for k, v in pairs(state) do
result[k] = v
end
data = {body = result}
name: O
type: DataTransformer
version: '1.0'
version: '1.0'
route: /sleep
This configuration exposes a single endpoint:
- Route: v1/0/sleep
- Method: GET/POST
- Pipeline: sleep, defined using pyfreeflow operators
Quickstart
Run the API server by providing a configuration file:
pyflowapi-server.py -c config.yaml
Reference
PyFreeFlow -> core library for pipeline definition and execution. FastAPI -> web framework powering the API layer.
License
This software is available under dual licensing:
Non-Commercial Use - AGPL v3
For non-commercial use, this software is released under the GNU Affero General Public License v3.0. Any modifications must be shared under the same license.
Commercial Use
For commercial use, please contact me.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyflowapi-0.2.0.tar.gz.
File metadata
- Download URL: pyflowapi-0.2.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6d2c859fe9cc8fbcf5accb39702de6e3c95c424769c43a4f71c9639bd311c06
|
|
| MD5 |
91a3e0af490a21f363065a60e41e9f3c
|
|
| BLAKE2b-256 |
793fe65fe17c52f086fdab9f7a84ed327e3588f3482be70fcb3752612a5eeee1
|
File details
Details for the file pyflowapi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyflowapi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f80f6a7b8f1dd800f0d5cfc94e464af867861d6aace25ab4c0b695010bcc4db0
|
|
| MD5 |
b9a65fc69f4956276b996538d5a855fb
|
|
| BLAKE2b-256 |
0c1cfa020493eb7ae26640fd25c4d8a1adcb96b159f91f457a81df2ec73cfbb1
|