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.
Metadata
Release files for pyflowapi 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyflowapi-0.2.0.tar.gz | 19.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyflowapi-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / pyflowapi-0.2.0.tar.gz
| Download URL | pyflowapi-0.2.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6d2c859fe9cc8fbcf5accb39702de6e3c95c424769c43a4f71c9639bd311c06
|
|
BLAKE2b-256 checksum How to use checksums |
793fe65fe17c52f086fdab9f7a84ed327e3588f3482be70fcb3752612a5eeee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / pyflowapi-0.2.0-py3-none-any.whl
| Download URL | pyflowapi-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f80f6a7b8f1dd800f0d5cfc94e464af867861d6aace25ab4c0b695010bcc4db0
|
|
BLAKE2b-256 checksum How to use checksums |
0c1cfa020493eb7ae26640fd25c4d8a1adcb96b159f91f457a81df2ec73cfbb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|