Skip to main content

Loco SDK

CI codecov PyPI version Python versions

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.

Quick Setup

# Install dependencies
just install

# Install pre-commit hooks (optional)
pip install pre-commit
pre-commit install

Quick Commands

Use the justfile for common tasks:

# Show all available commands
just --list

# Run tests with coverage
just test

# Format code
just format

# Lint code
just lint

# Type check
just type-check

# Run all quality checks
just quality

# Build package
just build

# Clean build artifacts
just clean

Or use commands directly:

# Run tests
pytest --cov=loco_sdk --cov-report=html -v

# Format code
black src tests

# Lint code
ruff check src tests

# Type check
mypy src

CI/CD

This project uses GitHub Actions for CI/CD:

  • CI Pipeline: Runs tests, linting, type checking on every push/PR
  • Publish Pipeline: Automatically publishes to PyPI on releases
  • Dependabot: Keeps dependencies up to date

See .github/workflows/README.md for details.

Documentation

See docs/ for detailed guides (coming soon).

Version

0.1.0

Release files for loco-sdk 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loco-sdk 0.4.0
File Size Uploaded
loco_sdk-0.4.0.tar.gz 61.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for loco-sdk 0.4.0
File Interpreter ABI Platform
loco_sdk-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 113.6 kB

Release files / loco_sdk-0.4.0.tar.gz

Download URL loco_sdk-0.4.0.tar.gz
Size 61.9 kB
Tags Source
SHA-256 checksum
How to use checksums
020a23d6288bd19b7d171bc28252a71d50bbfebb0bdba53075a04ee8d670e9e2
BLAKE2b-256 checksum
How to use checksums
1de1379a672fce40abae14ba001000ca7eded875292e3df805a85ad49c544f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / loco_sdk-0.4.0-py3-none-any.whl

Download URL loco_sdk-0.4.0-py3-none-any.whl
Size 51.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6eaf74b8650d323f219752dbdcfb150f37de2aba4f4503c185aa21e9d4827e9e
BLAKE2b-256 checksum
How to use checksums
0924a7819a7122dd025951d3066535156d737e1eb4b7fe61427d70fbe30b3f3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page