npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kernel-relay

v0.1.0

Published

websocket-zmq relay for Jupyter kernels

Downloads

4

Readme

kernel-relay

Server application used to connect an enchannel-socketio-backend to a Jupyter kernel.

Installation

To install kernel relay run

npm install -g kernel-relay

Kernel-relay should be installed on the same machine that the Jupyter kernels are installed on. After it's installed, run it using

kernel-relay

Background

In order to communicate with a kernel over the web, you either need to expose raw ZeroMQ sockets or translate to another layer which is friendly to most networking environments. The Jupyter Notebook uses direct websockets. This project, kernel-relay, connects to a kernel and relays ZMQ communications across socketio sockets. This allows web applications to use Jupyter kernels with socketio instead of ZMQ. kernel-relay includes a minimal RESTful API for managing kernel life cycles.

kernel-relay was designed to be used with enchannel-socketio-backend.

Usage

The CLI for kernel-relay is:

kernel-relay [port]

Kernel-relay's HTTP RESTful API listens on port 3000 by default.

RESTful API

spawn kernel

The RESTful API for spawning a kernel follows:

/spawn/[kernelSpecName]

The response is a JSON string. The success message contains the kernel's ID:

{
  "id": string
}

If an error occurs, the response is HTTP status 500 containing a JSON string with error information:

{
  "error": string
}

Example:

$ curl localhost:3000/spawn/python3
{"id":"d6f3beac-c8d3-489b-af64-b1e91dba0ad7"}

shutdown kernel

The RESTful API for shutting a kernel down follows:

/shutdown/[id]

The response is a JSON string. The success message contains the kernel's ID:

{
  "id": string
}

If an error occurs, the response is HTTP status 500 containing a JSON string with error information:

{
  "error": string
}

Example:

$ curl localhost:3000/shutdown/d6f3beac-c8d3-489b-af64-b1e91dba0ad7
{"id":"d6f3beac-c8d3-489b-af64-b1e91dba0ad7"}

socket.io connections

Socket.io connections are available at the following endpoints by kernel ID:

/shell/[id]
/stdin/[id]
/iopub/[id]
/control/[id]

The following is an example of how to connect to the shell channel using socket.io:

const io = require('socket.io-client');
const shell = io.connect('http://localhost:3000/shell/d6f3beac-c8d3-489b-af64-b1e91dba0ad7');

Development

To develop against kernel-relay, first clone the repo then from within the cloned folder run:

npm install
npm link

Before opening a pull request, please run the unit tests locally:

npm test