Writing a tabular IO plugin
Lynguine reads and writes tables through type: on a flow item
(allocation, input, output, …). Builtin names (csv,
excel, yaml, directory types, gsheet, …) stay in the core
package. A plugin implements another name in a separate package so
lynguine does not grow a vendor SDK.
This hook is CIP-0019. It is the table-store sibling of CIP-0013
document strategies. Use CIP-0013 when the source is a document (PDF,
DOCX, Google Docs body). Use CIP-0009 source: when the job is
fetch-then-read a file (HTTP or GitHub). Use CIP-0019 when the
authoritative store is a live API or query that should become a
DataFrame.
Point a new package at this page. Copy the skeleton below, change the type name, credential kind, and SDK calls.
Contract
Register from the plugin package at import time:
from lynguine.access.io import register_io_type
from lynguine.security.credentials import get_credential_manager
def validate_trello_api(credential):
value = credential.get("value", credential)
if isinstance(value, dict):
return "api_key" in value and "token" in value
return False
get_credential_manager().register_validator("trello_api", validate_trello_api)
def read_cards(details):
creds = details["credential_value"] # injected by lynguine
# creds is the stored payload, e.g. {"api_key": ..., "token": ...}
# Call the vendor SDK. Return one row per card / message / result.
import pandas as pd
return pd.DataFrame(...)
register_io_type(
"trello",
read=read_cards,
credential_type="trello_api",
)
read must return a pandas.DataFrame. write is optional. The
default is read-only. A writer runs only when both are true:
register_io_type(..., write=write_fn)the flow item sets
write: true
Otherwise write_data raises Type "trello" is read-only and does
not fall through to a file writer.
Builtin names cannot be overwritten. Registering csv or gsheet
raises ReservedIOTypeError.
Loading a plugin
Explicit import list (preferred). The interface names modules before
any read_data:
plugins:
- lynguine_trello
Failed imports name the module.
In-process registration is enough for tests and for apps that import the plugin themselves.
Optional entry points. In the plugin’s pyproject.toml:
[project.entry-points."lynguine.io_types"]
trello = "lynguine_trello:register"
The callable (or module import) must call register_io_type for that
type name. Lynguine loads that entry only when that type is requested
and is not already registered. import lynguine does not scan
plugins.
Package layout
A plugin package is ordinary Python. Minimum files:
lynguine_trello/
__init__.py # register validator + register_io_type
pyproject.toml # depends on lynguine; optional entry point above
tests/
test_read.py # mock credential_value; no network in CI
__init__.py can expose register() for the entry point, which
calls the same registration already run at import.
Zero-plugin path
Export the live store to YAML or CSV and use a builtin type:. Plugins
are for when the live store is the authoritative input.
What this is not
Not CIP-0013
register_strategy(documents → units).Not CIP-0009
source.type(download a file, then read it).Not referia
type: emailoutbound drafts.Not a marketplace. There is no version negotiation beyond importing the module you depend on.