Skip to Content
CLIOptixLog CLI Overview

OptixLog CLI Overview

The OptixLog CLI is a command-line interface for auto-instrumenting Python code and managing OptixLog experiments from the terminal.

What is OptixLog CLI?

OptixLog CLI is a Node.js-based tool that:

  • Auto-instruments code - Automatically adds OptixLog logging to Python scripts and Jupyter notebooks
  • Manages configuration - Stores API keys and settings in .optixlog.json
  • Integrates with SDK - Automatically detects and installs the Python SDK
  • Queries runs - List and manage experiments from the terminal
  • Smart code generation - Uses new SDK helpers for zero-boilerplate logging

Key Features

Auto SDK Detection

The CLI automatically detects if the OptixLog Python SDK is installed and offers to install it if missing:

$ optixlog add-logging script.py OptixLog SDK not found in Python environment Installing OptixLog SDK... SDK installed successfully!

Config Management

Store your API key and project settings in .optixlog.json:

optixlog init --project "MyProject" --api-key "proj_xxx"

Smart Code Generation

The CLI can generate code using new SDK helper methods:

optixlog add-logging script.py --smart

This generates code with:

  • Context manager (with optixlog.run())
  • Helper methods (log_matplotlib(), log_plot(), etc.)
  • Helpful comments and suggestions

Query Commands

List and manage runs from the terminal:

optixlog runs --project "MyProject" --limit 10

Use Cases

Quick Instrumentation

Add logging to existing Python scripts in seconds:

optixlog add-logging my_simulation.py python my_simulation.py

Team Collaboration

Share configuration files (without API keys) in version control:

# Team member 1 optixlog init --project "TeamProject" --local # Commits .optixlog.json (without API key) # Team member 2 optixlog config set api_key "proj_their_key" optixlog add-logging shared_code.py

Batch Processing

Instrument multiple files at once:

for file in *.py; do optixlog add-logging "$file" done

CI/CD Integration

Automate instrumentation in CI pipelines:

# In CI script optixlog init --project "CI_Runs" optixlog add-logging test_script.py python test_script.py

Architecture

The CLI is built with:

  • Node.js - Runtime environment
  • Commander.js - CLI framework
  • Axios - HTTP client for backend communication
  • TypeScript - Type-safe development

CLI vs SDK

FeatureCLISDK
PurposeCode instrumentationRuntime logging
When to useBefore running codeDuring code execution
LanguageNode.js/TypeScriptPython
Installationnpm install -g optixlog-clipip install http://optixlog.com/optixlog-0.0.4-py3-none-any.whl
WorkflowTransform code → RunLog during execution

Typical workflow:

  1. CLI - Instrument your code: optixlog add-logging script.py
  2. SDK - Run instrumented code: python script.py (SDK logs automatically)

Next Steps