Skip to content

Software

Extension DP provides SDKs for Python and TypeScript/JavaScript to make it easy to publish and consume Extension Data Packages.

Terminal window
pip install extensiondp frictionless
from extensiondp import Package, Table1, Table2
import frictionless
# Create Table1 records
record1 = Table1(
id="t1-001",
name="First Entity",
status="active",
value=100.5,
itemCount=5,
isVerified=True,
createdDate="2024-01-15",
description="This is the first example entity",
)
# Create Table2 records
record2 = Table2(
id="t2-001",
table1Id="t1-001",
title="Related Item",
amount=99.99,
priority="high",
percentage=75.5,
notes="This item is related to the first entity",
isActive=True,
)
package = Package(
{
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
"resources": [
{
"name": "table1",
"data": [record1],
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
},
{
"name": "table2",
"data": [record2],
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
},
],
}
)
frictionless.Package(package).to_json("extension.json")
import frictionless
report = frictionless.validate("extension.json")
print(report)
import frictionless
package = frictionless.Package("extension.json")
print(package)
Terminal window
npm install extensiondp dpkit
import type { Table1, Table2, Package } from "extensiondp";
import { savePackageDescriptor } from "dpkit";
const record1: Table1 = {
id: "t1-001",
name: "First Entity",
status: "active",
value: 100.5,
itemCount: 5,
isVerified: true,
createdDate: "2024-01-15",
description: "This is the first example entity",
};
const record2: Table2 = {
id: "t2-001",
table1Id: "t1-001",
title: "Related Item",
amount: 99.99,
priority: "high",
percentage: 75.5,
notes: "This item is related to the first entity",
isActive: true,
};
const dataPackage: Package = {
$schema:
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
resources: [
{
name: "table1",
data: [record1],
schema:
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
},
{
name: "table2",
data: [record2],
schema:
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
},
],
};
await savePackageDescriptor(dataPackage, {
path: "extension.json",
overwrite: true,
});
import { validatePackage } from "dpkit";
const { valid, errors } = await validatePackage("extension.json");
console.log(valid, errors);
import { loadPackageDescriptor } from "dpkit";
const dataPackage = await loadPackageDescriptor("extension.json");
console.log(dataPackage);
Terminal window
curl -fsSL https://dpkit.dev/install.sh | sh
Terminal window
./dp package validate extension.json
Terminal window
./dp table explore -p extension.json