Skip to main content

Workpeg function runtime and SDK

Project description

Workpeg SDK

SDK for building Workpeg Pegs and Functions.

Currently focused on:

  • workpeg-runtime – function execution runtime
  • workpeg-new-function – project scaffolding

Frontend features, Peg integrations, push & deployment tooling are coming soon.


Installation

pip install workpeg

Getting Started

1. Create a New Function

workpeg-new-function my-peg
cd my-peg

This generates:

my-peg/
  app/
    __init__.py
    main.py
  requirements.txt
  Dockerfile

2. Implement Your Function

Edit app/main.py:

def main(context, payload):
    return payload

Every Workpeg Function must define:

def main(context: dict, payload: dict) -> dict
  • context → execution metadata (provided by Workpeg)
  • payload → input data
  • return value → must be JSON serializable

3. Run Locally

echo '{"context": {}, "payload": {"hello": "world"}}' | workpeg-runtime

Example output:

{ "status": "success", "result": { "hello": "world" } }

Runtime

workpeg-runtime:

  1. Reads JSON from STDIN
  2. Loads app.main:main
  3. Executes the function
  4. Writes structured JSON to STDOUT

Override entrypoint:

FUNCTION_ENTRYPOINT="module.path:function_name" workpeg-runtime

Roadmap

  • Peg-level integrations
  • Frontend features (Streamlit/Reflex style)
  • Push & deployment tooling
  • Hosted execution

📘 Documentation coming soon.

MIT License

Project details


Download files

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

Source Distribution

workpeg-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

workpeg-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file workpeg-0.1.0.tar.gz.

File metadata

  • Download URL: workpeg-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for workpeg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93fea19b8cf1ce68a7eb90dc1109f430bed2d556cc8ab9e7f41cb980b68d4c80
MD5 331f2f371f8f3d80a33f7045b9ae5bf4
BLAKE2b-256 9d2bc27a4d0de3cad04b3d5d84ef654d6df60e43a7b59093e97d20be961d13ba

See more details on using hashes here.

File details

Details for the file workpeg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: workpeg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for workpeg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67597811e4d05118a1aa57924580aab61ca75e48418e5dcda1c269e59d8c46c8
MD5 69d96f5f42f37ee19c313e353de96973
BLAKE2b-256 5b99cb49f76449a10686de5c1372013d9b2edd9a285aea193fd1451e13fd1b80

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