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.
Quick Setup
# Install dependencies
make install
# Install pre-commit hooks (optional)
pip install pre-commit
pre-commit install
Quick Commands
Use the Makefile for common tasks:
# Show all available commands
make help
# Run tests with coverage
make test
# Format code
make format
# Lint code
make lint
# Type check
make type-check
# Run all quality checks
make quality
# Build package
make build
# Clean build artifacts
make 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
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
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 loco_sdk-0.2.5.tar.gz.
File metadata
- Download URL: loco_sdk-0.2.5.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eadaccbed517e93a03685cfae58adc46c618e0fcf5681fe7e9cc8e90ac6af18
|
|
| MD5 |
db85c2bc4bcbc6e28762e90eb2ee5e8e
|
|
| BLAKE2b-256 |
22a1e72fe29033d914b7e97f4916c29f18bd6e6350f62edea1b5f554ef1025e8
|
File details
Details for the file loco_sdk-0.2.5-py3-none-any.whl.
File metadata
- Download URL: loco_sdk-0.2.5-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03ccb18fda21ffbb001fdb986df69e1b9d97ec7a77fd225849d20b63a8e2edb6
|
|
| MD5 |
968981e83c0b6810d55426a4551517a1
|
|
| BLAKE2b-256 |
a14156e19061634ba808dce908f3ce299f5efa03a13bd6318f9431e7152ac743
|