CLIPlanned

CLI Commands Reference

Complete reference for all OptixLog CLI commands

CLI Commands Reference

Important: This documentation describes the intended behavior of the CLI. However, the CLI is currently not functional and is under active development. Please use the SDK directly for now.

Complete reference for all OptixLog CLI commands.

optixlog init

Initialize OptixLog configuration.

optixlog init [options]

Options

OptionDescription
-p, --project <name>Project name
-k, --api-key <key>API key
--api-url <url>API URL (default: https://optixlog.com)
-l, --localSave config locally (current directory) instead of home directory

Examples

Basic initialization:

optixlog init

With project and API key:

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

Local config (for version control):

optixlog init --project "TeamProject" --local

Custom API URL:

optixlog init --api-url "https://custom-backend.com"

What It Does

  1. Checks if SDK is installed (offers to install if missing)
  2. Creates .optixlog.json configuration file
  3. Saves API key, project name, and API URL
  4. Shows next steps

Config File Location

  • Local: .optixlog.json in current directory (if --local flag used)
  • Global: ~/.optixlog.json in home directory (default)

optixlog config

Manage OptixLog configuration.

optixlog config [action] [key] [value]

Actions

ActionDescription
list (default)List all configuration
get <key>Get specific config value
set <key> <value>Set config value

Examples

List all config:

optixlog config
# or
optixlog config list

Get specific value:

optixlog config get project
optixlog config get api_key

Set values:

optixlog config set project "NewProject"
optixlog config set api_key "proj_NEW_KEY"
optixlog config set api_url "https://optixlog.com"

Output

List:

📋 OptixLog Configuration

api_url:   https://optixlog.com
api_key:   ***abc12345
project:   MyProject

Config file: /Users/username/.optixlog.json

optixlog add-logging

Auto-instrument Python code with OptixLog.

optixlog add-logging <file> [options]

Arguments

ArgumentDescription
<file>Path to .py or .ipynb file

Options

OptionDescription
--no-backupDo not create backup file
--smartUse smart code generation with SDK helpers (local, no backend)

Examples

Basic instrumentation:

optixlog add-logging script.py

Smart mode (recommended):

optixlog add-logging script.py --smart

No backup:

optixlog add-logging script.py --no-backup

Jupyter notebook:

optixlog add-logging notebook.ipynb

What Gets Added

Basic mode (backend transformation):

  • Imports: import optixlog, import os
  • Initialization code with optixlog.run() or optixlog.init()
  • Logging statements for metrics and plots

Smart mode (local transformation):

  • Same as basic, plus:
  • Uses SDK helper methods (log_matplotlib(), log_plot(), etc.)
  • Wraps main code in context manager
  • Adds helpful comments and suggestions
  • Detects matplotlib usage and suggests helpers

Backup Files

By default, creates backup: script_backup.py or notebook_backup.ipynb

optixlog runs

List recent runs.

optixlog runs [options]

Options

OptionDescription
-p, --project <name>Filter by project name
-l, --limit <number>Number of runs to show (default: 10)

Examples

List last 10 runs:

optixlog runs

List last 20 runs:

optixlog runs --limit 20

Filter by project:

optixlog runs --project "MyProject"

Combined:

optixlog runs --project "MyProject" --limit 5

Output

🔍 Fetching runs...

Found 3 runs:

✓ experiment_1
  ID: run_abc123
  Project: MyProject
  Created: 2025-11-24T10:30:00Z

✓ experiment_2
  ID: run_def456
  Project: MyProject
  Created: 2025-11-24T11:45:00Z

Requirements

  • API key must be configured (via optixlog init or optixlog config set api_key)

optixlog check-sdk

Check if OptixLog SDK is installed in Python environment.

optixlog check-sdk

Examples

optixlog check-sdk

Output

If installed:

🔍 Checking SDK installation...

✓ OptixLog SDK is installed
Version: 0.0.4

If not installed:

🔍 Checking SDK installation...

⚠  OptixLog SDK is not installed

Install with:
  optixlog install-sdk
or manually:
  pip install optixlog

optixlog install-sdk

Install or upgrade OptixLog SDK.

optixlog install-sdk

Examples

optixlog install-sdk

What It Does

  1. Checks for local SDK path (for development)
  2. If found, installs from local: pip install -e /path/to/sdk
  3. Otherwise, installs from URL: pip install optixlog
  4. Verifies installation with version check

Output

⚙  Installing OptixLog SDK...
This may take a moment...

Installing from local: /path/to/sdk
✓ SDK installed successfully!
Version: 0.0.4

optixlog --version

Show CLI version.

optixlog --version

Output:

0.2.0

optixlog --help

Show help message.

optixlog --help
# or
optixlog help [command]

Command Workflow Examples

Complete Setup Workflow

# 1. Initialize
optixlog init --project "MyProject" --api-key "proj_xxx"

# 2. Verify SDK
optixlog check-sdk
# If not installed:
optixlog install-sdk

# 3. Instrument code
optixlog add-logging script.py --smart

# 4. Run code
python script.py

# 5. View runs
optixlog runs

Team Collaboration Workflow

# Team member 1: Create shared config
optixlog init --project "TeamProject" --local
# Commit .optixlog.json (without API key)

# Team member 2: Set their API key
optixlog config set api_key "proj_their_key"

# Both: Instrument and run
optixlog add-logging shared_code.py
python shared_code.py

Batch Processing Workflow

# Instrument multiple files
for file in *.py; do
    optixlog add-logging "$file" --smart
done

# Run all
for file in *.py; do
    python "$file"
done

# View all runs
optixlog runs --limit 50

Next Steps

On this page