Python SDK for Perceptic Workflow definitions - cross-language Temporal workflow types
Project description
Perceptic Workflow SDK
Python SDK for Perceptic Workflow definitions. This package provides cross-language Temporal workflow types that are compatible with the Java workflow definitions in perceptic-core-client.
Installation
uv add perceptic-workflow-sdk
Usage
Workflow Events
from perceptic_workflow import (
WorkflowEvent,
InfoEvent,
CheckpointEvent,
UserInputEvent,
UserInputRequestEvent,
WorkflowCheckpointStatus,
)
# Create events
info_event = InfoEvent(
event_id=1,
type="progress",
payload={"step": "processing"},
timestamp=datetime.now()
)
Implementing Workflows
The SDK provides a mixin class for implementing Perceptic-compatible workflows:
from temporalio import workflow
from perceptic_workflow import PercepticWorkflowMixin, WorkflowEvent
@workflow.defn
class MyWorkflow(PercepticWorkflowMixin):
def __init__(self):
self._events: list[WorkflowEvent] = []
self._paused = False
@workflow.run
async def run(self, input: dict) -> dict:
# Your workflow logic here
pass
@workflow.update(name=PercepticWorkflowMixin.UPDATE_SUBMIT_USER_INPUT)
async def submit_user_input(self, inputs: dict) -> None:
self._paused = False
# Handle user input
@workflow.update(name=PercepticWorkflowMixin.UPDATE_INTERRUPT)
async def interrupt(self, reason: str) -> None:
# Handle interruption
pass
@workflow.query(name=PercepticWorkflowMixin.QUERY_IS_PAUSED)
def is_paused(self) -> bool:
return self._paused
@workflow.query(name=PercepticWorkflowMixin.QUERY_GET_EVENTS)
def get_events(self, after_event_id: int | None = None) -> list[WorkflowEvent]:
if after_event_id is None:
return self._events
return [e for e in self._events if e.event_id > after_event_id]
Compatibility
This package is designed to be compatible with:
- perceptic-core-client (Java)
- perceptic-core-workflow-runtime (Java)
The workflow definitions and event types are generated from the same JSON Schema sources to ensure cross-language compatibility.
Project details
Release history Release notifications | RSS feed
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 perceptic_workflow_sdk-0.50.95.tar.gz.
File metadata
- Download URL: perceptic_workflow_sdk-0.50.95.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d9615a1872a992a2675962e6440290f51af632bb1b653572be998a5719f474
|
|
| MD5 |
9e9e1ce100be8c68cae27a17942773ad
|
|
| BLAKE2b-256 |
44f31b95842c23c9ce985cc6541f06827fa46a8cbe9b1ae944c6db9863968ca5
|
Provenance
The following attestation bundles were made for perceptic_workflow_sdk-0.50.95.tar.gz:
Publisher:
publish-python.yml on perceptic/perceptic-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perceptic_workflow_sdk-0.50.95.tar.gz -
Subject digest:
a1d9615a1872a992a2675962e6440290f51af632bb1b653572be998a5719f474 - Sigstore transparency entry: 955715895
- Sigstore integration time:
-
Permalink:
perceptic/perceptic-core@43135a9ef75649bcee47ba0750dbdf7ed99a748a -
Branch / Tag:
refs/tags/0.50.95 - Owner: https://github.com/perceptic
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@43135a9ef75649bcee47ba0750dbdf7ed99a748a -
Trigger Event:
push
-
Statement type:
File details
Details for the file perceptic_workflow_sdk-0.50.95-py3-none-any.whl.
File metadata
- Download URL: perceptic_workflow_sdk-0.50.95-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2805d20710e46ad1e91c77fa9718b7f6de5cbc2011a95b1ce4ca079e2f9d118
|
|
| MD5 |
e6d117bc8976e0b9e2228b20d146e26c
|
|
| BLAKE2b-256 |
b6e438b91a5fab58e10d1cf48657ca1d4d71bc4f6c4d46269bea10463307a30a
|
Provenance
The following attestation bundles were made for perceptic_workflow_sdk-0.50.95-py3-none-any.whl:
Publisher:
publish-python.yml on perceptic/perceptic-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perceptic_workflow_sdk-0.50.95-py3-none-any.whl -
Subject digest:
f2805d20710e46ad1e91c77fa9718b7f6de5cbc2011a95b1ce4ca079e2f9d118 - Sigstore transparency entry: 955715901
- Sigstore integration time:
-
Permalink:
perceptic/perceptic-core@43135a9ef75649bcee47ba0750dbdf7ed99a748a -
Branch / Tag:
refs/tags/0.50.95 - Owner: https://github.com/perceptic
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@43135a9ef75649bcee47ba0750dbdf7ed99a748a -
Trigger Event:
push
-
Statement type: