Skip to main content

Loco SDK for building plugins and shared utilities

Project description

Loco SDK

Official SDK for building Loco workflow plugins.

Installation

For Plugin Development

# Using pip
pip install loco-sdk

# Using uv (recommended)
uv pip install loco-sdk

For SDK Development

# Clone repository
cd packages/loco-sdk

# Install with dev dependencies using uv
uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uv pip install -e ".[dev]"

# Or with pip
pip install -e ".[dev]"

Quick Start

from loco_sdk import NodePlugin

class MyNode(NodePlugin):
    """My custom node."""

    async def execute(self, inputs: dict, context: dict) -> dict:
        """
        Execute node logic.

        Args:
            inputs: Node input values
            context: Workflow execution context with auth, sys_vars, etc.

        Returns:
            Output values dictionary
        """
        # Get authentication if needed
        auth = context.get("auth")
        if auth:
            headers = auth.get_header()
            # Use headers for API calls

        # Process inputs
        result = do_something(inputs)

        # Return outputs
        return {"result": result}

Authentication Helper

The SDK provides AuthContext to easily work with credentials:

from loco_sdk import NodePlugin, AuthContext

class MyNode(NodePlugin):
    async def execute(self, inputs: dict, context: dict) -> dict:
        # Wrap auth dict with helper
        auth = AuthContext(context.get("auth"))

        # Get Authorization header
        headers = auth.get_header()
        # Returns: {"Authorization": "Bearer <token>"}

        # Check token expiry
        if auth.is_expired():
            raise AuthenticationError("Token expired")

        # Access properties
        provider = auth.provider  # e.g., "google"
        scopes = auth.scopes      # OAuth scopes

        # Use in API calls
        response = await client.get(url, headers=headers)
        return {"data": response.json()}

Features

  • NodePlugin Base Class: Simple interface for workflow nodes
  • AuthContext Helper: Easy OAuth2/API key authentication
  • Type Safety: Full Pydantic schema support (coming soon)
  • Manifest Loading: Parse plugin.yaml files (coming soon)
  • Testing: Comprehensive test suite with pytest

Development

See DEVELOPMENT.md for detailed development guide including:

  • Setting up development environment with uv
  • Running tests with pytest
  • Code formatting and linting
  • Publishing to PyPI

Quick Commands

# Run tests
pytest

# Run tests with coverage
pytest --cov=loco_sdk --cov-report=html

# Format code
black src tests

# Lint code
ruff check src tests

# Type check
mypy src

Documentation

See docs/ for detailed guides (coming soon).

Version

0.1.0

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

loco_sdk-0.2.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

loco_sdk-0.2.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file loco_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: loco_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for loco_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 700b24ae66ac4c61cd2665eeedea1c8b01f56f24bc8d525f33c0a36a0ccf692c
MD5 34fc5ecc6675a6a19b9107d3627eaf0b
BLAKE2b-256 0c3e5abad81a2930ec1850cdb5eacad9aa33a0047779df62f19b052f3fe48725

See more details on using hashes here.

File details

Details for the file loco_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: loco_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for loco_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4e56d5f053163a987804fdbd85e38aa2c4ba64ba3e7bb5c442e9d1a9fe67a0
MD5 f8cba42414fcb641253ac5cb997d9663
BLAKE2b-256 94ca84901ed081863758d7318e0d990b37570f17c9e529bcba59df7bb0fdc576

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