Skip to main content

Auto-discover and serve Python functions over HTTP with a built-in RAM object store

Project description

vincta

Auto-discover and serve Python functions over HTTP with a built-in RAM object store.

Drop your functions in a folder, point vincta at it, and every function becomes a callable API endpoint. Heavy objects (DataFrames, arrays) are stored by reference so you never serialise large data over HTTP.

Install

pip install vincta

Quickstart

1. CLI — zero config

vincta --dir ./my_functions --port 8000

Any .py file in my_functions/ is auto-discovered. All public functions are registered and served instantly.

2. Call a function

curl -X POST http://localhost:8000/function/run \
  -H "Content-Type: application/json" \
  -d '{"function": "my_function", "inputs": {"x": 42}}'

3. Browse the API

Visit http://localhost:8000/docs for the auto-generated Swagger UI.


How it works

Object store

Heavy outputs (DataFrames, numpy arrays, dicts/lists > 100 items) are stored in RAM and returned as a lightweight ref string (obj_abc123). Pass the ref as input to the next function — vincta resolves it automatically.

POST /function/run  {"function": "load_csv", "inputs": {"path": "data.csv"}}
-> {"df_ref": "obj_abc123"}

POST /function/run  {"function": "compute_returns", "inputs": {"df_ref": "obj_abc123"}}
-> {"result_ref": "obj_def456"}

Primitives (int, float, str, bool, small dicts) are returned inline, never stored.

Auto-discovery

vincta imports every .py file in your --dir folders and registers all public functions with schemas inferred from type hints.


Exposing your own functions

Option A — plain functions (auto-registered)

# my_functions/transforms.py
import pandas as pd

def compute_returns(df: pd.DataFrame) -> pd.DataFrame:
    """Compute pct change for all numeric columns."""
    return df.select_dtypes("number").pct_change().dropna()
vincta --dir ./my_functions

Option B — decorator for explicit schema

Use @register_function when inputs are object refs (str) but you want the API docs to be meaningful:

from vincta import register_function
import pandas as pd

@register_function(
    name="clean_data",
    inputs={"df_ref": "str", "threshold": "float"},
    outputs={"clean_ref": "str"},
    description="Drop rows with nulls above threshold.",
)
def clean_data(df: pd.DataFrame, threshold: float) -> pd.DataFrame:
    return df.dropna(thresh=int(len(df.columns) * threshold))

Option C — flat-import codebases

If your codebase uses flat imports (from indicators import ... instead of from mypackage.indicators import ...), add --sys-path so Python can resolve them:

vincta --dir ./MyCodebase --sys-path ./MyCodebase --port 8000

Embedding in your own FastAPI app

from fastapi import FastAPI
from vincta.routers import execution, functions, objects

app = FastAPI()
app.include_router(functions.router)
app.include_router(execution.router)
app.include_router(objects.router)

Programmatic registration

from vincta import register, discover_and_import
from pathlib import Path

# Register a single function
register(my_fn, name="my.function", inputs={"x": "float"}, outputs={"y": "float"})

# Run discovery on a directory
discover_and_import([Path("./my_functions")])

Object store API

from vincta import store_object, retrieve_object, delete_object, list_refs

ref = store_object(my_dataframe)   # -> "obj_abc123"
df  = retrieve_object(ref)
delete_object(ref)
print(list_refs())

API reference

Method Path Description
GET /functions List all registered functions with schemas
POST /function/run Execute a function by name
GET /object/{ref} Preview a stored object (shape, columns, head)
DELETE /object/{ref} Free an object from RAM
GET /object/list All current object refs
GET /object/memory RAM usage breakdown
GET /health Function count + object count

CLI reference

vincta --dir DIR [--dir DIR ...]
       [--sys-path PATH ...]
       [--host HOST]
       [--port PORT]
       [--exclude PATTERN]
       [--reload]
       [--workers N]
Flag Default Description
--dir Directory to discover functions from (repeatable)
--sys-path Extra path prepended to sys.path before discovery (repeatable)
--host 127.0.0.1 Bind host
--port 8000 Bind port
--exclude test_*,*.test.py Glob patterns to exclude
--reload off Enable auto-reload (development)
--workers 1 Worker processes (ignored with --reload)

Notes

  • The object store is in-process RAM only — refs are lost on server restart.
  • Functions are registered by name. Duplicate names overwrite silently.
  • python -m vincta works as an alternative to the vincta CLI command.

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

vincta-0.1.4.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

vincta-0.1.4-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file vincta-0.1.4.tar.gz.

File metadata

  • Download URL: vincta-0.1.4.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for vincta-0.1.4.tar.gz
Algorithm Hash digest
SHA256 976b436b2cb87f660e2fcb30dd524778c0d8ba0386281d637565e802a4d1976c
MD5 e9860ff251990a4aae1c694eea1c7d30
BLAKE2b-256 fa929912f17ffd9cbe4b1b63195891106164111b59dd156b71ecb32031af4e3c

See more details on using hashes here.

File details

Details for the file vincta-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: vincta-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for vincta-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6d1715e4d3e71eaafe5df3466dd84a71499c9dbabfa2d849512ae4ee1014e5f4
MD5 0a27c40bf5928d4a115e2761aae8485b
BLAKE2b-256 76b874769fd587c80aa9b71ca163ae7c8352ab1273533550f18186a8c5bb77d5

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