Write a source plugin

A source plugin is a Python package that defines tables as dataclasses and extracts data from an API. dlt handles incremental loading and schema management. You focus on the API.

pyproject.toml
[project]
name = "shenas-source-myapi"
dependencies = ["dlt[duckdb]>=1.24.0", "shenas-source-core"]

[project.entry-points."shenas.sources"]
myapi = "shenas_sources.myapi.source:MyApiSource"
1

Scaffold the package

Create the directory tree under plugins/sources/myapi/, then add pyproject.toml with the shenas.sources entry point pointing at your source class.

2

Define your tables

Each table is a dataclass extending EventTable. The extract classmethod yields raw dicts from your API client. dlt handles schema inference and incremental loading.

3

Create the source class

The source class wires together your client and tables. Implement build_client to construct the API client from config, and resources to return the list of tables.

4

Install and sync

Run uv sync to install the plugin as a workspace member, then shenasctl source myapi sync to pull the first batch. Your data lands in a local DuckDB database, queryable from dashboards and transforms.

Other plugin types

Transform SQL, geofence, geocode, regex extract, LLM categorize — or write your own transform type.
Dashboard Lit web components that query via Arrow IPC. Charts, tables, timelines — anything visual.
Dataset Define canonical metric tables (daily HRV, transactions, events). Transforms write into these.
Frontend The UI shell itself is a plugin. Write your own or extend the default.
Theme CSS custom properties that style everything at once. Ship a .css file and a Python class.
Analysis Hypothesis-driven analysis modes. Define an operation vocabulary and recipe strategy.