Options
All
  • Public
  • Public/Protected
  • All
Menu

Package fs-kernels

@nteract/fs-kernels

This package contains functions for launching a Jupyter kernel, getting stats on it, and shutting it down.

Installation

$ yarn add @nteract/fs-kernels
$ npm install --save @nteract/fs-kernels

Usage

The example below shows how we can use this package to:

  • create a new kernel (new Kernel(kernelName))
  • launch and connect to the kernel (kernel.launch())
  • retrieve usage stats about the kernel's process (kernel.getUsage())
  • terminate the kernel (kernel.shutdown()).
import Kernel from "@nteract/fs-kernels";

export default async () => { const kernelName = "python3"; const kernel = new Kernel(kernelName); await kernel.launch(); console.log(kernel.getUsage()); await kernel.shutdown(); };

Documentation

You can view the reference documentation for @nteract/fs-kernels in the package docs.

Support

If you experience an issue while using this package or have a feature request, please file an issue on the issue board and, if possible, add the pkg:fs-kernels label.

License

BSD-3-Clause

Index

Variables

Let askJupyterPromise

askJupyterPromise: Promise<JupyterPaths> | null = null

Const readdir

readdir: Function = promisify(fs.readdir)

Let sysPrefixGuess

sysPrefixGuess: string | null | undefined

Functions

accessCheck

  • accessCheck(d: fs.PathLike): boolean

askJupyter

cleanup

  • cleanup(connectionFile: fs.PathLike): void

configDirs

  • configDirs(opts?: object): Promise<string[]>

Private createConnectionInfo

  • createConnectionInfo(ports: number[]): JupyterConnectionInfo
  • Creates a JupyterConnectionInfo object for a kernel given an array of comm channel ports

    Parameters

    • ports: number[]

      array of comm channel ports to use for the connection, [hb_port, control_port, shell_port, stdin_port, iopub_port]

    Returns JupyterConnectionInfo

    JupyterConnectionInfo object

dataDirs

  • dataDirs(opts?: object): Promise<string[]>
  • dataDirs returns all the expected static directories for this OS. The user of this function should make sure to make sure the directories exist.

    When withSysPrefix is set, this returns a promise of directories

    Parameters

    • Optional opts: object
      • Optional askJupyter?: function
      • Optional withSysPrefix?: boolean

    Returns Promise<string[]>

    All the Jupyter Data Dirs

find

findAll

guessSysPrefix

  • guessSysPrefix(): string | null | undefined

home

  • home(subDir?: string): string

launch

launchKernel

launchSpec

launchSpecFromConnectionInfo

  • launchSpecFromConnectionInfo(kernelSpec: KernelSpec, config: JupyterConnectionInfo, connectionFile: string, spawnOptions?: Options): Promise<LaunchedKernel>
  • Launch a kernel for a given kernelSpec and connection info

    Parameters

    • kernelSpec: KernelSpec

      describes a specific kernel, see the npm package kernelspecs

    • config: JupyterConnectionInfo

      connection config

    • connectionFile: string

      path to the config file

    • Optional spawnOptions: Options

    Returns Promise<LaunchedKernel>

    spawnResults

mapToKernelResources

pushIfExists

  • pushIfExists(paths: string[], pathToPush: string): void

runtimeDir

  • runtimeDir(opts?: object): Promise<string>

systemConfigDirs

  • systemConfigDirs(): string[]

systemDataDirs

  • systemDataDirs(): string[]

userDataDir

  • userDataDir(): string

writeConnectionFile

Generated using TypeDoc