How zenml-io/vscode-zenml works
Project type and purpose
• This is a Visual Studio Code extension that integrates with the ZenML Python library to provide an in-IDE MLOps experience.
• It ships both TypeScript code (the VSCode “client” extension) and a bundled Python LSP server that communicates over JSON-RPC/stdin-stdout.
File structure
• Top level:
– src/ – all TypeScript sources for commands, views, services, common utilities, and the extension entry point
– bundled/tool/ – Python LSP server implementation and ZenML wrappers
– resources/ – static assets (CSS/JS) used in Webviews (DAG viewer, forms)
– scripts/, .github/, configuration files – build, lint, CI/CD pipeline definitions
• src/commands & src/views: implement the UI and command handlers in VSCode’s extension host
• src/services: event bus, LSP client wrapper, and the central “ZenExtension” orchestrator
• bundled/tool: LSP server uses ZenML Python SDK and watchdog to reflect real-time state
README for additional insights
• Uses the Language Server Protocol to synchronize with ZenML in the user’s Python environment
• Watches the file system for configuration changes (watchdog)
• Renders DAGs in a VSCode Webview and provides Activity Bar tree views for servers, projects, stacks, pipelines, models
Main components and their relationships
a. VSCode Extension Host (TypeScript)
– UI layer: Activity Bar views, Webview panels, Status Bar entries
– Command handlers: user actions mapped to commands in src/commands
– Services: EventBus, LSClient (the JSON-RPC client), ZenExtension orchestrator
b. Python LSP Server (bundled/tool)
– Exposes JSON-RPC endpoints for listing servers, stacks, pipelines, models, and for rendering DAGs
– Uses ZenML SDK to query and modify the user’s ZenML environment
– Uses watchdog to watch ZenML config files and sends notifications to the client on change
c. ZenML Core (external dependency)
– The Python library providing the actual MLOps functionality
d. File System Watcher (watchdog)
– Notifies the LSP server of changes in ZenML config, triggering JSON-RPC notifications
e. VSCode API
– Commands, tree data providers, Webview panels, status bar items
[User Click] → VSCode Command Handler → EventBus → LSClient → Python LSP Server
Python LSP Server → (ZoenML SDK) → ZenML Core → returns data
Python LSP Server → JSON-RPC Notification → LSClient → EventBus → UI Update
DAG Render: Command handler → LSClient → LSP server → returns graph data → Webview panel in VSCode
Architectural patterns and design principles
• Separation of concerns: UI (commands/views) vs. orchestration (services) vs. data source (LSP server)
• Event-driven communication within the extension (EventBus)
• JSON-RPC client–server pattern for cross-process comms
• Plugin–host model: VSCode extension host (client) + external Python process (LSP server)
• Micro-frontends in Webviews (DAG view, forms) loaded from resources/
Elements
• Labels for each component/module (e.g., EventBus, LSClient, Webview panel, LSP server)
– Core services (EventBus, LSClient) in another
– Python server and SDK in a third