or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

client-server.mdcolors-transforms.mdcommand-line.mddocument-management.mdembedding-integration.mdevents-interactivity.mdindex.mdio-operations.mdlayouts.mdmodels-data-sources.mdplotting-interface.mdserver-applications.mdwidgets.md

command-line.mddocs/

0

# Command Line Interface

1

2

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.

3

4

## Capabilities

5

6

### Server Commands

7

8

Commands for running and managing Bokeh server applications.

9

10

```bash { .api }

11

bokeh serve [OPTIONS] [FILES_OR_DIRS]...

12

```

13

14

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

15

16

**Parameters:**

17

- `FILES_OR_DIRS`: Python files, directories, or Jupyter notebooks to serve

18

- `--port PORT`: Server port (default: 5006)

19

- `--address ADDRESS`: Server bind address (default: localhost)

20

- `--log-level LEVEL`: Log level (trace, debug, info, warn, error, fatal)

21

- `--log-format FORMAT`: Log format (default: standard format)

22

- `--log-file PATH`: Log file path (default: stderr)

23

- `--args ARGS`: Command-line arguments for served applications

24

- `--show`: Open browser automatically

25

- `--dev`: Enable development mode with auto-reload

26

- `--allow-websocket-origin HOST:PORT`: Allow websocket connections from origin

27

- `--host HOST:PORT`: Public hostname for generating URLs

28

- `--prefix PREFIX`: URL prefix for the server

29

- `--keep-alive MILLISECONDS`: Keep-alive ping interval

30

- `--check-unused-sessions MILLISECONDS`: Check for unused sessions interval

31

- `--unused-session-lifetime MILLISECONDS`: Unused session lifetime

32

- `--stats-log-frequency MILLISECONDS`: Stats logging frequency

33

- `--use-xheaders`: Enable X-headers support for reverse proxies

34

35

**Examples:**

36

```bash

37

# Serve single Python file

38

bokeh serve myapp.py

39

40

# Serve multiple applications

41

bokeh serve app1.py app2.py --show

42

43

# Serve with custom port and development mode

44

bokeh serve myapp.py --port 8080 --dev

45

46

# Serve directory-based application

47

bokeh serve myproject/ --allow-websocket-origin=example.com:80

48

49

# Serve with URL prefix

50

bokeh serve myapp.py --prefix=/bokeh --port 5007

51

```

52

53

### JSON Output Commands

54

55

Commands for generating JSON representations of Bokeh content.

56

57

```bash { .api }

58

bokeh json [OPTIONS] [FILES]...

59

```

60

61

Generate JSON output from Bokeh applications or scripts.

62

63

**Parameters:**

64

- `FILES`: Python files to process

65

- `--output PATH`: Output file path (default: stdout)

66

- `--indent SPACES`: JSON indentation spaces

67

- `--args ARGS`: Command-line arguments for applications

68

69

**Examples:**

70

```bash

71

# Generate JSON from Python file

72

bokeh json myapp.py --output myapp.json

73

74

# Generate formatted JSON

75

bokeh json myapp.py --indent 2

76

77

# Generate JSON with application arguments

78

bokeh json myapp.py --args "--param value"

79

```

80

81

### Static Content Commands

82

83

Commands for building and managing static Bokeh content.

84

85

```bash { .api }

86

bokeh static [OPTIONS] [DIRECTORY]

87

```

88

89

Build static versions of Bokeh applications for deployment.

90

91

**Parameters:**

92

- `DIRECTORY`: Target directory for static content

93

- `--build-dir PATH`: Build directory path

94

- `--verbose`: Enable verbose output

95

96

**Examples:**

97

```bash

98

# Build static content

99

bokeh static build/

100

101

# Build with verbose output

102

bokeh static build/ --verbose

103

```

104

105

### Build Commands

106

107

Commands for building Bokeh applications and resources.

108

109

```bash { .api }

110

bokeh build [OPTIONS]

111

```

112

113

Build Bokeh applications and generate required resources.

114

115

**Parameters:**

116

- `--build-dir PATH`: Build output directory

117

- `--rebuild`: Force complete rebuild

118

- `--verbose`: Enable verbose build output

119

120

**Examples:**

121

```bash

122

# Standard build

123

bokeh build

124

125

# Force complete rebuild

126

bokeh build --rebuild

127

128

# Build to specific directory

129

bokeh build --build-dir ./dist

130

```

131

132

### Project Initialization

133

134

Commands for creating new Bokeh projects and applications.

135

136

```bash { .api }

137

bokeh init [OPTIONS] [DIRECTORY]

138

```

139

140

Initialize a new Bokeh project with template files.

141

142

**Parameters:**

143

- `DIRECTORY`: Project directory name

144

- `--template TEMPLATE`: Project template to use

145

- `--force`: Overwrite existing files

146

147

**Examples:**

148

```bash

149

# Create new project

150

bokeh init myproject

151

152

# Create from specific template

153

bokeh init myproject --template basic

154

155

# Force overwrite existing directory

156

bokeh init myproject --force

157

```

158

159

### Settings Management

160

161

Commands for managing Bokeh configuration and settings.

162

163

```bash { .api }

164

bokeh settings [OPTIONS] [SUBCOMMAND]

165

```

166

167

Manage Bokeh configuration settings and preferences.

168

169

**Subcommands:**

170

- `list`: List all configuration settings

171

- `get KEY`: Get specific setting value

172

- `set KEY VALUE`: Set configuration value

173

- `reset`: Reset to default settings

174

175

**Examples:**

176

```bash

177

# List all settings

178

bokeh settings list

179

180

# Get specific setting

181

bokeh settings get resources.minified

182

183

# Set configuration value

184

bokeh settings set resources.minified false

185

186

# Reset all settings

187

bokeh settings reset

188

```

189

190

### Secret Management

191

192

Commands for managing secrets and security settings.

193

194

```bash { .api }

195

bokeh secret [OPTIONS] [SUBCOMMAND]

196

```

197

198

Manage application secrets and security configuration.

199

200

**Subcommands:**

201

- `create`: Create new secret

202

- `list`: List existing secrets

203

- `delete NAME`: Delete secret by name

204

205

**Parameters:**

206

- `--name NAME`: Secret name

207

- `--value VALUE`: Secret value

208

- `--file PATH`: Read secret from file

209

210

**Examples:**

211

```bash

212

# Create new secret

213

bokeh secret create --name api_key --value "secret123"

214

215

# Create secret from file

216

bokeh secret create --name certificate --file cert.pem

217

218

# List all secrets

219

bokeh secret list

220

221

# Delete secret

222

bokeh secret delete api_key

223

```

224

225

### Information and Help Commands

226

227

Commands for getting information about Bokeh and available functionality.

228

229

```bash { .api }

230

bokeh info [OPTIONS]

231

```

232

233

Display Bokeh installation and environment information.

234

235

**Examples:**

236

```bash

237

# Show version and installation info

238

bokeh info

239

240

# Show detailed environment information

241

bokeh info --verbose

242

```

243

244

```bash { .api }

245

bokeh --help

246

bokeh [COMMAND] --help

247

```

248

249

Display help information for commands.

250

251

**Examples:**

252

```bash

253

# General help

254

bokeh --help

255

256

# Command-specific help

257

bokeh serve --help

258

bokeh json --help

259

```

260

261

### Version Information

262

263

```bash { .api }

264

bokeh --version

265

```

266

267

Display Bokeh version information.

268

269

## Usage Examples

270

271

### Development Workflow

272

273

```bash

274

# Create new project

275

bokeh init my_dashboard

276

277

# Navigate to project

278

cd my_dashboard

279

280

# Serve in development mode with auto-reload

281

bokeh serve main.py --dev --show

282

283

# Build for production deployment

284

bokeh build --build-dir ./dist

285

286

# Serve production build

287

bokeh serve dist/ --port 8080 --allow-websocket-origin=mydomain.com:8080

288

```

289

290

### Multi-Application Server

291

292

```bash

293

# Serve multiple applications on different paths

294

bokeh serve \

295

--port 5006 \

296

dashboard.py \

297

analytics.py \

298

monitoring.py \

299

--show

300

301

# Applications will be available at:

302

# http://localhost:5006/dashboard

303

# http://localhost:5006/analytics

304

# http://localhost:5006/monitoring

305

```

306

307

### Production Deployment

308

309

```bash

310

# Production server with reverse proxy support

311

bokeh serve myapp.py \

312

--port 5006 \

313

--address 0.0.0.0 \

314

--allow-websocket-origin=example.com:80 \

315

--allow-websocket-origin=example.com:443 \

316

--prefix=/bokeh \

317

--use-xheaders \

318

--log-level info \

319

--log-file /var/log/bokeh.log

320

```

321

322

### Configuration Management

323

324

```bash

325

# Check current settings

326

bokeh settings list

327

328

# Configure for development

329

bokeh settings set log.level debug

330

bokeh settings set resources.minified false

331

332

# Configure for production

333

bokeh settings set log.level warn

334

bokeh settings set resources.minified true

335

336

# Reset to defaults

337

bokeh settings reset

338

```

339

340

### Static Site Generation

341

342

```bash

343

# Generate static HTML files

344

bokeh json app1.py --output app1.json

345

bokeh json app2.py --output app2.json --indent 2

346

347

# Build static site

348

bokeh static ./static_site/

349

350

# The static files can be served by any web server

351

```

352

353

### Security and Secrets

354

355

```bash

356

# Set up application secrets

357

bokeh secret create --name database_url --value "postgresql://..."

358

bokeh secret create --name api_key --file ./api_key.txt

359

360

# List configured secrets

361

bokeh secret list

362

363

# Applications can access secrets via environment or config

364

```

365

366

## Common Options and Environment Variables

367

368

### Global Options

369

370

Available for all commands:

371

372

- `--help`: Show help message

373

- `--version`: Show version information

374

- `--verbose`: Enable verbose output

375

- `--quiet`: Suppress non-error output

376

377

### Environment Variables

378

379

```bash { .api }

380

# Configuration

381

BOKEH_LOG_LEVEL=debug # Set default log level

382

BOKEH_RESOURCES=inline # Resource loading mode

383

BOKEH_MINIFIED=false # Use minified resources

384

385

# Server settings

386

BOKEH_PORT=5006 # Default server port

387

BOKEH_ADDRESS=localhost # Default bind address

388

BOKEH_ALLOW_WS_ORIGIN=* # Allowed websocket origins

389

390

# Development

391

BOKEH_DEV=true # Enable development mode

392

BOKEH_PRETTY=true # Pretty-print JSON output

393

```

394

395

## Common Data Types

396

397

```bash { .api }

398

# Port specification

399

PORT := 1024-65535

400

401

# Address specification

402

ADDRESS := IP_ADDRESS | HOSTNAME

403

404

# Log levels

405

LOG_LEVEL := trace | debug | info | warn | error | fatal

406

407

# File paths

408

PATH := ABSOLUTE_PATH | RELATIVE_PATH

409

410

# URLs and origins

411

ORIGIN := PROTOCOL://HOST:PORT

412

URL_PREFIX := /PATH_SEGMENT

413

414

# Time intervals (milliseconds)

415

MILLISECONDS := INTEGER

416

```