npm.io
2.0.2 • Published 11 years ago

jupyter-kernel-watch

Licence
BSD
Version
2.0.2
Deps
1
Vulns
0
Weekly
0
Stars
4

jupyter-kernel-watch

Watches jupyter kernel directories for you.

NPM

| Travis

var KernelWatch = require('jupyter-kernel-watch')
var watcher = KernelWatch(['/path/to/kernels', '/another/path/to/.jupyter/kernels'])

watcher.on('data', function (kernelSpecs) {
  // kernelSpecs is a list of the contents of the kernel.json as a JSON object
  // e.g. [
  // {
  //   "filepath": "/path/to/kernels/python/kernel.json",
  //   "data": { "display_name": "Python 2", "language": "python", "argv": [ etc...]}
  //  }
  // ]
  //
})

watcher.close()

API

KernelWatch(dirs)

Returns a watcher

dirs: the directories to watch

watcher.close()

Closes the watcher -- stops watching the filesystem.

Events

There should be more, but right now it just emits one event -- that's when the kernel spec (kernel.json) has changed.

kernelspecs
watcher.on('data', function (kernelSpecs) {
  // list of kernelspecs
})

Keywords