This directory contains optional integrations that extend Praxis with additional functionality. Each integration is self-contained and can be automatically loaded based on CLI flags or conditions.
Each subdirectory contains an integration with its own README.md describing its purpose and usage.
Each integration follows a standard structure:
integration-name/
├── __init__.py # Main integration module
├── spec.yaml # Integration specification
└── pyproject.toml # Python dependencies (optional, preferred over spec.yaml dependencies)
- Create a new directory in
/integrations/with your integration name - Add a
spec.yamlfile defining the integration:
name: your-integration
version: 1.0.0
description: Brief description of what your integration does
conditions:
- "args.your_flag" # Activation condition
provides:
- cli_args # If adding CLI arguments
- lifecycle # If providing init/cleanup hooks
- loggers # If providing logging functionality
- datasets # If providing dataset loaders
# Optional: Dependencies can be specified here or in pyproject.toml
dependencies:
python:
- package-name>=1.0.0- (Recommended) Add a minimal
pyproject.tomlfor dependencies:
[project]
name = "praxis-integration-your-integration"
version = "0.1.0"
dependencies = [
"package-name>=1.0.0",
]- Implement the integration in
__init__.py:
from praxis.integrations.base import BaseIntegration
class YourIntegration(BaseIntegration):
def add_cli_args(self, parser):
"""Add CLI arguments for this integration."""
parser.add_argument('--your-flag', action='store_true',
help='Enable your integration')
def initialize(self, args, cache_dir, **kwargs):
"""Initialize the integration."""
if args.your_flag:
# Setup code here
pass
def cleanup(self):
"""Clean up resources."""
passIntegrations are automatically discovered and loaded by the IntegrationLoader class:
- Discovery happens at startup by scanning this directory
- Integrations are loaded conditionally based on their
spec.yamlconditions - Dependencies are automatically installed if missing
- Multiple integrations can be active simultaneously
- Self-contained: Keep all integration code within its directory
- Conditional loading: Use conditions to avoid loading when not needed
- Clean shutdown: Implement cleanup methods for proper resource management
- Documentation: Include clear documentation in your integration
- Dependencies: Use pyproject.toml for dependencies (preferred) or spec.yaml as fallback
- Error handling: Gracefully handle missing dependencies or initialization failures
- Package naming: Use
praxis-integration-{name}convention for pyproject.toml package names
To test if integrations are loading correctly:
# List available integrations
python -c "from praxis.integrations.loader import IntegrationLoader; loader = IntegrationLoader(); specs = loader.discover_integrations(); print([s.name for s in specs])"
# Run with specific integration
python main.py --ngrok # or --wandb, --gun, --quantum-
If an integration isn't loading, check that:
- The
spec.yamlfile is valid YAML - The conditions in spec.yaml match your CLI flags
- Required dependencies are installed
- The
__init__.pyfollows the correct structure
- The
-
Integration logs appear in the console with
[INTEGRATIONS]prefix -
Failed integrations are silently skipped to avoid breaking the main application