Skip to main content

kp-schema-sdk

kp Schema Registry — Shared Python enums and Pydantic v2 event models for all kp domain events across 20 modules (134 events).

Installation

pip install kp-schema-sdk==1.0.0

Always pin to an exact version. Do not use >= or ~= — this is a contract package.

Requirements

  • Python ≥ 3.10
  • pydantic ≥ 2.0.0

Usage

from kp_schema.generated.models import OrderCreatedEvent, BuyerBehaviorRecordedEvent
from kp_schema.shared_enums import OrderStatus, VendorStatus

# Validate an inbound event
raw = {
    "eventType": "order.created.v1",
    "correlationId": "req-abc-123",
    "timestamp": "2026-05-25T10:00:00Z",
    "payload": {
        "orderId": "order-xyz",
        "userId": "user-abc",
        "storeIds": ["store-1"],
        "totalKobo": 25000,
        "itemCount": 2,
        "isQrOrder": False,
        "checkoutSessionId": "chk-def",
    }
}
event = OrderCreatedEvent(**raw)
print(event.payload.order_id)   # "order-xyz"
print(event.payload.total_kobo) # 25000

# Use enums
status = OrderStatus.PENDING
assert status == "PENDING"  # str enum

Top-level import (convenience)

# Import everything from the top-level package
from kp_schema import OrderCreatedEvent, OrderStatus

Available Exports

kp_schema.shared_enums

All Prisma enums as Python str, Enum subclasses (JSON-safe serialization):

  • OrderStatus — PENDING, CONFIRMED, PREPARING, READY_FOR_PICKUP, OUT_FOR_DELIVERY, COMPLETED, CANCELLED, FAILED, REFUNDED
  • VendorStatus — PENDING, ACTIVE, SUSPENDED, REJECTED
  • UserRole — BUYER, VENDOR, ADMIN, SUPER_ADMIN, SUPPORT
  • ProductStatus — DRAFT, ACTIVE, ARCHIVED
  • DeliveryStatus — PENDING, ASSIGNED, PICKED_UP, IN_TRANSIT, DELIVERED, FAILED, RETURNED
  • NotificationChannel — PUSH, IN_APP, EMAIL, SMS
  • 20+ additional enums — see kp_schema/shared_enums/__init__.py

kp_schema.generated.models

Pydantic v2 models with Field(alias="camelCase") + populate_by_name: True:

Class Event type
OrderCreatedEvent order.created.v1
OrderCompletedEvent order.completed.v1
OrderCancelledEvent order.cancelled.v1
BuyerBehaviorRecordedEvent buyer.behavior.recorded.v1
BuyerAffinityUpdatedEvent buyer.affinity.updated.v1
BuyerStreakUpdatedEvent buyer.streak.updated.v1
InventoryStockUpdatedEvent inventory.stock.updated.v1
InventoryOutOfStockEvent inventory.product.out_of_stock.v1
IntelligenceIntentSignalEvent intelligence.intent.signal.generated.v1
IntelligenceAffinityUpdatedEvent intelligence.affinity.updated.v1
AuthLoginSucceededEvent auth.login.succeeded.v1
LogisticsDispatchCreatedEvent logistics.dispatch.created.v1
LogisticsDeliveryCompletedEvent logistics.delivery.completed.v1
CommunityViralSignalEvent community.viral_signal.generated.v1

Union Types

from kp_schema.generated.models import AnyOrderEvent, AnyInventoryEvent, AnyIntelligenceEvent

Field Naming Convention

All models use camelCase JSON aliases with snake_case Python attributes:

event = OrderCreatedEvent(**json_data)
event.payload.order_id         # snake_case Python access
event.payload.model_dump(by_alias=True)["orderId"]  # camelCase JSON output

Version Policy

This package follows the kp Schema Registry semver rules:

  • MAJOR — breaking change (field removed, type changed, event removed)
  • MINOR — additive change (new event, new optional field)
  • PATCH — editorial (description updates, constraint relaxation)

Source

Generated from: contracts/events/ in kp-schema-registry

Do not edit generated files directly — raise a PR in the schema registry instead.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kp_schema_registry-2.20.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kp_schema_registry-2.20.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file kp_schema_registry-2.20.0.tar.gz.

File metadata

  • Download URL: kp_schema_registry-2.20.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for kp_schema_registry-2.20.0.tar.gz
Algorithm Hash digest
SHA256 81d2a0c6f4a9e3b9b45c0f024a38d7a5fe7032439469cd15a0af38ea63cd3cde
MD5 3178964be6d7bb02ce6ce879254c5eb2
BLAKE2b-256 4462aecda727150b152793703e8d103017fd6ff8b08e78ea071ee6eefa5050c0

See more details on using hashes here.

File details

Details for the file kp_schema_registry-2.20.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kp_schema_registry-2.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f415415ab2ae9343f1424be1c3bcb4e621670fce000e6d222e2ce6a24c9cc1a
MD5 30d93b92ebac5d263b938bd08d113388
BLAKE2b-256 8e321e3c84211b09e88a6ea0cd8d46d0b4a920d58832be5e7bde1eeb7a75d12c

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 Sentry Error logging StatusPage Status page