Skip to main content

Workpeg function runtime and SDK

Project description

Workpeg SDK

Python SDK for building Workpeg functions and Pegs.

The SDK provides tools to:

  • Create new Workpeg function projects
  • Run functions locally
  • Submit function packages to the Workpeg registry

More features are coming, including Peg development tools, UI capabilities, and deployment workflows.

Repository https://gitlab.com/workpeg/workpeg-sdk


Installation

pip install workpeg

Or install from source:

pip install -e .

Getting Started

1. Create a new function project

workpeg new-function my-function

This creates a project scaffold like:

my-function/
  app/
    __init__.py
    main.py

Your function lives in app/main.py.

Example:

def main(context, payload):
    return {
        "message": "Hello from Workpeg",
        "payload": payload
    }

2. Run locally

Functions are executed through the runtime.

Example:

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

Output:

{
  "status": "success",
  "result": {
    "message": "Hello from Workpeg",
    "payload": {"name": "world"}
  }
}

The runtime expects input in this format:

{
  "context": {...},
  "payload": {...}
}

3. Submit a function

Package your function and submit it to the Workpeg registry.

workpeg submit my-function:1.0.0

Authentication is provided through the WORKPEG_PK environment variable.

Example:

export WORKPEG_PK=<your-token>

The function will be uploaded to:

https://repo.workpeg.com

Function Entrypoint

By default the runtime loads:

app.main:main

You can override this using an environment variable:

FUNCTION_ENTRYPOINT=module.path:function

Example:

FUNCTION_ENTRYPOINT=app.main:handler workpeg runtime

Project Structure

Typical function project:

my-function
 ├─ app
 │  ├─ __init__.py
 │  └─ main.py
 └─ requirements.txt

Roadmap

The SDK will expand to support:

  • Peg development tooling
  • UI features for building Peg interfaces
  • Packaging and deployment workflows
  • Function sandboxing and execution tooling

Documentation

Full documentation is coming soon.


License

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.1.tar.gz (14.0 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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for workpeg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 53e98320eec2a1b1bdf7c3c648c509a393e32911e84079d0db06a27bed0f834b
MD5 4adc721c019c2a8766bf99dc1f0ec468
BLAKE2b-256 8a13b2a6ed6ea044680ecde17301f4161f9d35e0c3c543c5453ff9ee2c152bf4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for workpeg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a6b94023b95afc6a9bf8930c704b0fdea6cc55a7fdde86e167d35e9b46b9d7
MD5 e0b2b2027a606703701c5c7a9a7e3b83
BLAKE2b-256 963935ba400d0774bfd15c972ed4eb7808d0c8fc31dfc829130c3c8547a5dd92

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