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

arepl-backend

v3.0.5

Published

JS interface to python evaluator for AREPL

Downloads

379

Readme

AREPL-backend npm version example workflow

JS interface to python evaluator for AREPL.

Evaluates python code and sends back the user variables and/or any errors.

Although it is meant for AREPL, it is not dependent upon AREPL and can be used by any project.

Important Note: this should ONLY be used to execute trusted code. It does not have any security features whatsoever.

Installation

npm install arepl-backend

Must have python 3.7 or greater

Usage

see https://github.com/Almenon/AREPL-vscode for example useage.

For developers:

Semantic release cheatsheet:

| Commit message       | Release type |
|----------------------|--------------|
| fix: msg             | patch        |
| feat: msg            | feature      |
| perf: msg            |              |
| BREAKING CHANGE: msg | breaking     |

API

Table of Contents

PythonState

Starting = Starting or restarting. Ending = Process is exiting. Executing = Executing inputted code. DirtyFree = evaluator may have been polluted by side-effects from previous code, but is free for more code. FreshFree = evaluator is ready for the first run of code

constructor

starts python_evaluator.py

Parameters

  • options Process / Python options. If not specified sensible defaults are inferred. (optional, default {})

execCode

does not do anything if program is currently executing code

Parameters

  • code

sendStdin

Parameters

restart

kills python process and restarts. Force-kills if necessary after 50ms. After process restarts the callback passed in is invoked

Parameters

  • callback (optional, default ()=>{})

stop

Kills python process. Force-kills if necessary after 50ms. You can check python_evaluator.running to see if process is dead yet

Parameters

  • kill_immediately (optional, default false)

start

starts python_evaluator.py. Will NOT WORK with python 2

Parameters

  • finishedStartingCallback

onResult

Overwrite this with your own handler. is called when program fails or completes

Parameters

  • foo

onPrint

Overwrite this with your own handler. Is called when program prints

Parameters

onStderr

Overwrite this with your own handler. Is called when program logs stderr

Parameters

handleResult

handles pyshell results and calls onResult / onPrint

Parameters

checkSyntax

checks syntax without executing code

Parameters

Returns Promise rejects w/ stderr if syntax failure

formatPythonException

gets rid of unnecessary File "" message in exception

Parameters

  • err

Examples

err:
Traceback (most recent call last):\n  File "<string>", line 1, in <module>\nNameError: name \'x\' is not defined\n