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, REFUNDEDVendorStatus— PENDING, ACTIVE, SUSPENDED, REJECTEDUserRole— BUYER, VENDOR, ADMIN, SUPER_ADMIN, SUPPORTProductStatus— DRAFT, ACTIVE, ARCHIVEDDeliveryStatus— PENDING, ASSIGNED, PICKED_UP, IN_TRANSIT, DELIVERED, FAILED, RETURNEDNotificationChannel— 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kp_schema_registry-2.25.0.tar.gz.
File metadata
- Download URL: kp_schema_registry-2.25.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b0461469dabac3ea87995e20094977971bfbdaa97a5b5e7df40b021a116afbb
|
|
| MD5 |
db6320d930733cb286921e661b7e463f
|
|
| BLAKE2b-256 |
71b75d762f1f544189a6f1b47ea580f29f96f5b0e1783d38ec42baa774f03aff
|
File details
Details for the file kp_schema_registry-2.25.0-py3-none-any.whl.
File metadata
- Download URL: kp_schema_registry-2.25.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c8f291b5d887e86932313b12e63102fbeb9398c85c4b6dcf6ec26f4b99974ee
|
|
| MD5 |
4992bc80b9ea82beb82becb214569ce1
|
|
| BLAKE2b-256 |
c240e41d3f704813d5602d5c2807c086c5436351f49248438662289e0ca13370
|