or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-commands.mdconfiguration.mdenvironment.mdhooks-plugins.mdindex.mdtask-execution.mdutilities.md
tile.json

tessl/pypi-tutor

The Docker-based Open edX distribution designed for peace of mind

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/tutor@20.0.x

To install, run

npx @tessl/cli install tessl/pypi-tutor@20.0.0

index.mddocs/

Tutor

The Docker-based Open edX distribution designed for peace of mind. Tutor is the official Open edX distribution that simplifies deployment, customization, upgrading, and scaling of Open edX platforms through complete Docker containerization and extensible plugin architecture.

Package Information

  • Package Name: tutor
  • Language: Python
  • Installation: pip install tutor
  • CLI Command: tutor

Core Imports

import tutor

For working with configuration:

from tutor import config
from tutor.types import Config, ConfigValue

For plugin development:

from tutor import hooks
from tutor.plugins import base
from tutor.core.hooks import Action, Filter, Context

For environment and template rendering:

from tutor import env
from tutor.env import JinjaEnvironment, Renderer

For CLI and task execution:

from tutor.commands.context import Context, BaseTaskContext
from tutor.tasks import BaseTaskRunner, BaseComposeTaskRunner

For utilities and formatting:

from tutor import utils, fmt
from tutor.exceptions import TutorError

Basic Usage

Command Line Interface

# Initialize and launch Open edX platform locally
tutor local launch

# Configure the platform
tutor config save --interactive

# Install and enable plugins
tutor plugins install discovery
tutor plugins enable discovery

# Run in development mode
tutor dev launch

# Deploy to Kubernetes
tutor k8s launch

Programmatic Configuration

from tutor import config
from tutor.commands.context import Context

# Load configuration
context = Context("/path/to/tutor/root")
config_data = config.load(context.root)

# Update configuration
config_data["PLATFORM_NAME"] = "My Open edX Platform"
config.save_config_file(context.root, config_data)

Architecture

Tutor's architecture enables flexible Open edX deployment across multiple environments:

  • CLI Commands: User-facing commands for deployment, configuration, and management
  • Hooks System: Event-driven plugin architecture with Actions and Filters
  • Plugin Framework: Extensible system supporting v0 (YAML) and v1 (Python) plugins
  • Environment Rendering: Jinja2-based template system for generating configuration files
  • Task Runners: Environment-specific execution contexts (Local, Dev, Kubernetes)

This design provides a unified interface for Open edX deployment while supporting extensive customization through plugins and configuration templates.

Capabilities

Command Line Interface

Complete CLI for Open edX deployment and management with commands for local development, production deployment, configuration management, plugin administration, and image building.

def main() -> None: ...
class TutorCli(click.Group): ...
def cli(context: click.Context, root: str, show_help: bool) -> None: ...

CLI Commands

Configuration Management

Centralized configuration system with support for defaults, user overrides, environment variables, and interactive setup.

def load(root: str) -> Config: ...
def load_defaults() -> Config: ...
def load_minimal(root: str) -> Config: ...
def save(context: Context, **kwargs) -> None: ...

Configuration

Hooks and Plugin System

Event-driven plugin architecture enabling extensibility through Actions, Filters, and Contexts for lifecycle management and data transformation.

class Action[T]:
    def add(self, priority: int = None) -> Callable: ...
    def do(self, *args, **kwargs) -> None: ...

class Filter[T1, T2]:
    def add(self, priority: int = None) -> Callable: ...
    def apply(self, value: T1, *args, **kwargs) -> T2: ...

Hooks and Plugins

Environment and Templates

Template rendering system using Jinja2 for generating Docker Compose configurations, Kubernetes manifests, and application settings.

def render_file(config: Config, *path: str) -> str: ...
def save_file(root: str, filename: str, content: str) -> None: ...

Environment Management

Task Execution

Abstract task runner framework supporting different deployment contexts (Local, Dev, Kubernetes) with Docker Compose integration.

class BaseTaskRunner:
    def run_task(self, service: str, command: str) -> int: ...
    def render(self, *path: str) -> str: ...

Task Execution

Utilities and Types

Core utilities for encryption, file operations, string processing, bind mount management, YAML serialization, and type definitions for configuration management.

ConfigValue = Union[str, float, None, bool, List[str], List[Any], Dict[str, Any], Dict[Any, Any]]
Config = Dict[str, ConfigValue]

def encrypt(text: str) -> str: ...
def random_string(length: int) -> str: ...
def parse_mount(value: str) -> list[tuple[str, str, str]]: ...
def load(stream: Union[str, IO[str]]) -> Any: ...

Utilities

Types

# Standard library imports for type annotations
from typing import Union, Dict, List, Any, Optional, Callable, IO, Iterator, Iterable
from _io import TextIOWrapper
import click

# Core configuration types
ConfigValue = Union[str, float, None, bool, List[str], List[Any], Dict[str, Any], Dict[Any, Any]]
Config = Dict[str, ConfigValue]

# Context type for CLI operations
class Context:
    def __init__(self, root: str): ...
    @property
    def root(self) -> str: ...

class BaseTaskContext(Context):
    def job_runner(self, config: Config) -> BaseTaskRunner: ...

# Base exception
class TutorError(Exception): ...

# Task runner base classes
class BaseTaskRunner:
    def __init__(self, root: str, config: Config): ...
    def run_task(self, service: str, command: str) -> int: ...

class BaseComposeTaskRunner(BaseTaskRunner):
    def docker_compose(self, *command: str) -> int: ...

# Environment classes
class JinjaEnvironment:
    def read_str(self, template_name: str) -> str: ...
    def read_bytes(self, template_name: str) -> bytes: ...

class Renderer:
    def __init__(self, config: Optional[Config] = None): ...
    def render_str(self, text: str) -> str: ...
    def render_template(self, template_name: str) -> Union[str, bytes]: ...