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

@statsim/port

v0.2.1

Published

Port is a highly opinionated GUI wrapper for processing tasks. Not even close to R's [shiny](https://shiny.rstudio.com/) or Python's [streamlit](https://streamlit.io/). Mostly used in [StatSim Apps](https://statsim.com/#apps).

Downloads

2

Readme

Port ⚓

Port is a highly opinionated GUI wrapper for processing tasks. Not even close to R's shiny or Python's streamlit. Mostly used in StatSim Apps.

Port is based on the idea of declarative interface design and reactivity. Instead of writing a "glue" front-end code, you can declare inputs/outputs of a model in a JSON schema and Port will do the rest. Port creates a Vue app based on the provided schema, parses files, loads needed libraries, orchestrates communication between code and GUI and uses Web Workers to run everything smoothly. It's not a swiss-army knife, not a framework. Port solves one specific task - wrapping algorithms in a simple web interface.

How it works

             Schema   Model   Render*
    DEV ->    json    js/py     js
               .        .        .
             __Y________Y________Y___
            |                        |
            |      new Port (...)    |
            |________________________|
               .               .
             __Y__       ______Y_____
            |     |     |            | <~ tf.js
  USER  <-> | GUI | <-> |    Model   | <~ pyodide
            |_____|     |____________| <~ wasm
              Vue³        WebWorker*

* - optional
    |x]
   /|
  /_|___
  \    /
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Port takes a schema object that contains five main blocks:

  • model - describes a model/script (its location, is it a function or class, should it be called automatically on every GUI change)
  • render - visualization part (optional)
  • design - overall appearance (optional)
  • inputs - list of inputs and their descriptions
  • outputs - list of outputs and their descriptions (optional)

Config/schema object

  • model - Contains main parameters of the model/script
    • url (string) - URL of a JS/Python file to load, or:
    • code (function) - It's possible to pass functions directly to Port instead of using an URL
    • name (string) - Name of the callable object. Default value is taken from url or code
    • autorun (boolean, default - false) - Defines if the script should be evaluated on each input change event
    • type (string, default - function) - What kind of script is loaded. Influences how the code is initializated. Possible values:
      • function
      • class
      • async-function
      • async-init
      • py
      • tf
    • method (string) - If type is class, method defines the name of the class method to call during evaluation
    • container (string) - How input values are passed to the function/method:
      • object (default) - Pass inputs wrapped in an object, i.e. {'x': 1, 'y': 2}
      • args - Pass inputs as separate arguments
    • worker (boolean) - If true, Port initializes a Web Worker to run the script
  • render - Custom rendering script. Instead of relying on Port for output visualization, you can provide a custom script that visualizes the results. That can be useful if you rely on custom libs for plotting.
  • design - Design parameters
    • layout - Layout for the model/input/output blocks. If it's empty and the Port container is not, Port uses inner HTML as a template. If the container is empty too, it uses the default blocks template.
    • framework - Design framework to use. If a JavaScript object with the same name is present in a global context, Port loads it too (using Vue's use method).
  • inputs - Inputs definition
  • outputs - Outputs definition