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
Release files for loco-sdk 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| loco_sdk-0.2.6.tar.gz | 32.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loco_sdk-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.5 kB
Release files / loco_sdk-0.2.6.tar.gz
| Download URL | loco_sdk-0.2.6.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bb5bd54a7bfa1949866f6c3d23afe7a370257516abeed24bbf26b4af989dde8
|
|
BLAKE2b-256 checksum How to use checksums |
fac466e4f32b2fb1f1694f3d2f3548437e2f20b0a06273b50f4e022be1558b88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / loco_sdk-0.2.6-py3-none-any.whl
| Download URL | loco_sdk-0.2.6-py3-none-any.whl |
|---|---|
| Size | 28.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a20bf4bf18bb680fd0f314402e895d6213f5e18fe26ecfc2f3e2f56bb7388817
|
|
BLAKE2b-256 checksum How to use checksums |
77d007b30bdd1d86fd03aa116044e28ef7df046802e26a1927fce1fad3a010e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|