mirror of
https://github.com/apache/superset.git
synced 2026-04-07 18:35:15 +00:00
apache-superset-core
The official core package for building Apache Superset backend extensions and integrations. This package provides essential building blocks including base classes, API utilities, type definitions, and decorators for both the host application and extensions.
📦 Installation
pip install apache-superset-core
🏗️ Package Structure
src/superset_core/
├── common/
├── extensions/
├── mcp/
├── queries/
├── rest_api/
├── tasks/
└── __init__.py
🚀 Quick Start
Basic Extension API
from flask_appbuilder.api import expose, permission_name, protect, safe
from superset_core.rest_api.api import RestApi
from superset_core.rest_api.decorators import api
@api(id="dataset_references", name="Dataset References API")
class DatasetReferencesAPI(RestApi):
@expose("/metadata", methods=("POST",))
@protect()
@safe
@permission_name("read")
def metadata(self) -> Response:
# ... endpoint implementation
Background Tasks
from superset_core.tasks.decorators import task
from superset_core.tasks.types import TaskScope
@task(name="generate_report", scope=TaskScope.SHARED)
def generate_report(chart_id: int) -> None:
# ... task implementation
MCP Tools
from superset_core.mcp.decorators import tool
@tool(name="my_tool", description="Custom business logic", tags=["extension"])
def my_extension_tool(param: str) -> dict:
# ... tool implementation
MCP Prompts
from superset_core.mcp.decorators import prompt
@prompt(name="my_prompt", title="My Prompt", description="Interactive prompt", tags={"extension"})
async def my_prompt_handler(ctx: Context) -> str:
# ... prompt implementation
📄 License
Licensed under the Apache License, Version 2.0. See LICENSE for details.