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

v0.1.3

Published

real-time python scratchpad

Downloads

37

Readme

AREPL: vscode edition Build Status Downloads Downloads Gitter chat

AREPL automatically evaluates python code in real-time as you type

Alt Text

AREPL is availible from the vscode marketplace or as a standalone app

Useage

First, make sure you have python 3 installed.

Open a python file and run AREPL through the command search

control-shift-p

or use a shortcut: control-shift-a / command-shift-a

Features

  • Real-time evaluation: no need to run - AREPL evaluates your code automatically. You can control this (or even turn it off) in the settings

  • Variable display: The final state of your local variables are displayed in a collapsible JSON format

  • Error display: The instant you make a mistake an error with stack trace is shown

  • Settings: AREPL offers many settings to fit your user experience. Customize the look and feel, debounce time, python options, and more!

Misc

dumping

If you want to dump local variables or dump variables at a specific point in your program you can use the dump function:

from arepldump import dump 

def milesToKilometers(miles):
    kilometers = miles*1.60934
    dump() # dumps all the vars in your function

    # or dump when function is called for a second time
    dump(None,1) 

milesToKilometers(2*2)
milesToKilometers(3*3)

for char in ['a','b','c']:
    dump(char,2) # dump a var at a specific iteration

a=1
dump(a) # dump specific vars at any point in your program
a=2

#$save

If you want to avoid a section of code being executed in real-time (due to it being slow or calling external resources) you can use #$save. For example:

def largest_prime_factor(n):
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
    return n

# this takes a looonnggg time to execute
result = largest_prime_factor(8008514751439999)

#$save
print("but now that i saved i am back to real-time execution")
import random
x = random.random()
#$save
print(x) # this number will not change when editing below the #$save line

Please note that #$save does not work with certain types, like generators. If #$save fails in pickling the code state file an issue so I can look into it.

GUIS

You can use arepl for working with gui's like turtle or many others. Each time you edit the code the gui restarts, so to make it less annoying the typing debounce is automatically increased for a longer delay before execution. Or you can switch to execute on save. I also suggest coding it so the gui appears on the side (not blocking your view of your code), like so:

import turtle

turtle.setup(width=500, height=500, startx=-1, starty=0)

turtle.forward(100)
turtle.left(90)

VENV

to use you arepl with VENV you can set the AREPL.pythonPath setting to reference the location of your venv python

Variable Representation

I have overridden the display of some types (like datetime) to be more readable to humans.

If you want a type to be displayed in a particular manner just file an issue

Imports

Python caches imports, so even though AREPL runs with every code change the import will run only once at the start. This saves time when importing large libraries like numpy.

But you can also use this feature as a caching mechanism by moving code you only want AREPL to execute once into a different file and importing it.

If you don't want caching you can delete the library at the end of the file, like so:

import library
# bla bla bla code
del sys.modules['library'] # arepl will reload import next execution

Deveveloper Setup

  1. Install VSCode, python 3 and npm (if not already installed)
  2. clone this repository
  3. npm install
  4. start debugging

see AREPL-backend for the npm package that executes the python code