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.2.tar.gz (13.8 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.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vincta-0.1.2.tar.gz
  • Upload date:
  • Size: 13.8 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.2.tar.gz
Algorithm Hash digest
SHA256 96552fa400ec8b54440bde5966aed7cfb761433d2f2fa1bb55b99d192f7a6fd6
MD5 9b97e5147f62269e2783a8fe467848f5
BLAKE2b-256 8315cf295e54c1995b73eca1464c4a711cb769aee2bc95db251d44e1fcd79065

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vincta-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba8c477ab18fdbb1b5c59fa483a017d97c39a18f89cc661d7255f83acf491344
MD5 957a182ff8d5ad3be4de10fa6a2ffaa1
BLAKE2b-256 cd2c038380ea790bf4f1592f32f3af5eaedc6265f304945e2bd3d93e072dcdbb

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