CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-bokeh

Interactive plots and applications in the browser from Python

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

command-line.mddocs/

Command Line Interface

Comprehensive command-line tools for Bokeh development, deployment, and management. The bokeh command provides subcommands for serving applications, building static content, managing configurations, and working with Bokeh projects.

Capabilities

Server Commands

Commands for running and managing Bokeh server applications.

bokeh serve [OPTIONS] [FILES_OR_DIRS]...

Serve Bokeh applications from Python files, directories, or notebooks.

Parameters:

  • FILES_OR_DIRS: Python files, directories, or Jupyter notebooks to serve
  • --port PORT: Server port (default: 5006)
  • --address ADDRESS: Server bind address (default: localhost)
  • --log-level LEVEL: Log level (trace, debug, info, warn, error, fatal)
  • --log-format FORMAT: Log format (default: standard format)
  • --log-file PATH: Log file path (default: stderr)
  • --args ARGS: Command-line arguments for served applications
  • --show: Open browser automatically
  • --dev: Enable development mode with auto-reload
  • --allow-websocket-origin HOST:PORT: Allow websocket connections from origin
  • --host HOST:PORT: Public hostname for generating URLs
  • --prefix PREFIX: URL prefix for the server
  • --keep-alive MILLISECONDS: Keep-alive ping interval
  • --check-unused-sessions MILLISECONDS: Check for unused sessions interval
  • --unused-session-lifetime MILLISECONDS: Unused session lifetime
  • --stats-log-frequency MILLISECONDS: Stats logging frequency
  • --use-xheaders: Enable X-headers support for reverse proxies

Examples:

# Serve single Python file
bokeh serve myapp.py

# Serve multiple applications  
bokeh serve app1.py app2.py --show

# Serve with custom port and development mode
bokeh serve myapp.py --port 8080 --dev

# Serve directory-based application
bokeh serve myproject/ --allow-websocket-origin=example.com:80

# Serve with URL prefix
bokeh serve myapp.py --prefix=/bokeh --port 5007

JSON Output Commands

Commands for generating JSON representations of Bokeh content.

bokeh json [OPTIONS] [FILES]...

Generate JSON output from Bokeh applications or scripts.

Parameters:

  • FILES: Python files to process
  • --output PATH: Output file path (default: stdout)
  • --indent SPACES: JSON indentation spaces
  • --args ARGS: Command-line arguments for applications

Examples:

# Generate JSON from Python file
bokeh json myapp.py --output myapp.json

# Generate formatted JSON
bokeh json myapp.py --indent 2

# Generate JSON with application arguments
bokeh json myapp.py --args "--param value"

Static Content Commands

Commands for building and managing static Bokeh content.

bokeh static [OPTIONS] [DIRECTORY]

Build static versions of Bokeh applications for deployment.

Parameters:

  • DIRECTORY: Target directory for static content
  • --build-dir PATH: Build directory path
  • --verbose: Enable verbose output

Examples:

# Build static content
bokeh static build/

# Build with verbose output
bokeh static build/ --verbose

Build Commands

Commands for building Bokeh applications and resources.

bokeh build [OPTIONS]

Build Bokeh applications and generate required resources.

Parameters:

  • --build-dir PATH: Build output directory
  • --rebuild: Force complete rebuild
  • --verbose: Enable verbose build output

Examples:

# Standard build
bokeh build

# Force complete rebuild
bokeh build --rebuild

# Build to specific directory
bokeh build --build-dir ./dist

Project Initialization

Commands for creating new Bokeh projects and applications.

bokeh init [OPTIONS] [DIRECTORY]

Initialize a new Bokeh project with template files.

Parameters:

  • DIRECTORY: Project directory name
  • --template TEMPLATE: Project template to use
  • --force: Overwrite existing files

Examples:

# Create new project
bokeh init myproject

# Create from specific template  
bokeh init myproject --template basic

# Force overwrite existing directory
bokeh init myproject --force

Settings Management

Commands for managing Bokeh configuration and settings.

bokeh settings [OPTIONS] [SUBCOMMAND]

Manage Bokeh configuration settings and preferences.

Subcommands:

  • list: List all configuration settings
  • get KEY: Get specific setting value
  • set KEY VALUE: Set configuration value
  • reset: Reset to default settings

Examples:

# List all settings
bokeh settings list

# Get specific setting
bokeh settings get resources.minified

# Set configuration value
bokeh settings set resources.minified false

# Reset all settings
bokeh settings reset

Secret Management

Commands for managing secrets and security settings.

bokeh secret [OPTIONS] [SUBCOMMAND]

Manage application secrets and security configuration.

Subcommands:

  • create: Create new secret
  • list: List existing secrets
  • delete NAME: Delete secret by name

Parameters:

  • --name NAME: Secret name
  • --value VALUE: Secret value
  • --file PATH: Read secret from file

Examples:

# Create new secret
bokeh secret create --name api_key --value "secret123"

# Create secret from file
bokeh secret create --name certificate --file cert.pem

# List all secrets
bokeh secret list

# Delete secret
bokeh secret delete api_key

Information and Help Commands

Commands for getting information about Bokeh and available functionality.

bokeh info [OPTIONS]

Display Bokeh installation and environment information.

Examples:

# Show version and installation info
bokeh info

# Show detailed environment information
bokeh info --verbose
bokeh --help
bokeh [COMMAND] --help

Display help information for commands.

Examples:

# General help
bokeh --help

# Command-specific help
bokeh serve --help
bokeh json --help

Version Information

bokeh --version

Display Bokeh version information.

Usage Examples

Development Workflow

# Create new project
bokeh init my_dashboard

# Navigate to project
cd my_dashboard

# Serve in development mode with auto-reload
bokeh serve main.py --dev --show

# Build for production deployment
bokeh build --build-dir ./dist

# Serve production build
bokeh serve dist/ --port 8080 --allow-websocket-origin=mydomain.com:8080

Multi-Application Server

# Serve multiple applications on different paths
bokeh serve \
  --port 5006 \
  dashboard.py \
  analytics.py \
  monitoring.py \
  --show

# Applications will be available at:
# http://localhost:5006/dashboard
# http://localhost:5006/analytics  
# http://localhost:5006/monitoring

Production Deployment

# Production server with reverse proxy support
bokeh serve myapp.py \
  --port 5006 \
  --address 0.0.0.0 \
  --allow-websocket-origin=example.com:80 \
  --allow-websocket-origin=example.com:443 \
  --prefix=/bokeh \
  --use-xheaders \
  --log-level info \
  --log-file /var/log/bokeh.log

Configuration Management

# Check current settings
bokeh settings list

# Configure for development
bokeh settings set log.level debug
bokeh settings set resources.minified false

# Configure for production
bokeh settings set log.level warn  
bokeh settings set resources.minified true

# Reset to defaults
bokeh settings reset

Static Site Generation

# Generate static HTML files
bokeh json app1.py --output app1.json
bokeh json app2.py --output app2.json --indent 2

# Build static site
bokeh static ./static_site/

# The static files can be served by any web server

Security and Secrets

# Set up application secrets
bokeh secret create --name database_url --value "postgresql://..."
bokeh secret create --name api_key --file ./api_key.txt

# List configured secrets
bokeh secret list

# Applications can access secrets via environment or config

Common Options and Environment Variables

Global Options

Available for all commands:

  • --help: Show help message
  • --version: Show version information
  • --verbose: Enable verbose output
  • --quiet: Suppress non-error output

Environment Variables

# Configuration
BOKEH_LOG_LEVEL=debug          # Set default log level
BOKEH_RESOURCES=inline         # Resource loading mode
BOKEH_MINIFIED=false          # Use minified resources

# Server settings
BOKEH_PORT=5006               # Default server port
BOKEH_ADDRESS=localhost       # Default bind address
BOKEH_ALLOW_WS_ORIGIN=*       # Allowed websocket origins

# Development
BOKEH_DEV=true               # Enable development mode
BOKEH_PRETTY=true            # Pretty-print JSON output

Common Data Types

# Port specification
PORT := 1024-65535

# Address specification  
ADDRESS := IP_ADDRESS | HOSTNAME

# Log levels
LOG_LEVEL := trace | debug | info | warn | error | fatal

# File paths
PATH := ABSOLUTE_PATH | RELATIVE_PATH

# URLs and origins
ORIGIN := PROTOCOL://HOST:PORT
URL_PREFIX := /PATH_SEGMENT

# Time intervals (milliseconds)
MILLISECONDS := INTEGER

Install with Tessl CLI

npx tessl i tessl/pypi-bokeh

docs

client-server.md

colors-transforms.md

command-line.md

document-management.md

embedding-integration.md

events-interactivity.md

index.md

io-operations.md

layouts.md

models-data-sources.md

plotting-interface.md

server-applications.md

widgets.md

tile.json