Skip to main content
Build WebAssembly plugins using Python. Noorle uses componentize-py to compile Python to WASI Preview 2 WebAssembly.

Setup

Install Tools

Project Structure

Define Tools

Tools are Python functions exported from your plugin.

Simple Function

Complex Types

Type Annotations

Python type hints define the tool interface:
Supported types:
  • str - String
  • int - Integer
  • float - Floating point
  • bool - Boolean
  • List[T] - Array of type T
  • Dict[str, T] - Object with string keys
  • Optional[T] - Nullable type

Working with Dependencies

Add Dependencies

Edit pyproject.toml:

Install and Build

Size Considerations

Large dependencies increase plugin size:

File I/O

Access allowed filesystem paths via environment or configuration.

Configure Permissions

In noorle.yaml:

Environment Variables

Access configuration via environment variables.
Configure in .env:

Network Access

Make HTTP requests to allowed hosts.
Or use requests (add to pyproject.toml):
Configure network permissions:

Error Handling

Return errors gracefully:

Testing

Test your plugin locally before uploading.

Unit Tests

Run tests:

Integration Tests

Building and Deploying

Build

Upload

Best Practices

Input Validation

Logging

Documentation

Example: Complete Plugin

Troubleshooting

Build fails with “componentize-py not found”:
Plugin too large (>5MB):
  • Remove unnecessary dependencies
  • Use lighter alternatives
  • Check import statements
Type errors during build:
  • Ensure all function parameters have type hints
  • Check return type annotations
  • Verify List/Dict syntax: List[str], Dict[str, int]

Next Steps