Giter Site home page Giter Site logo

arepl-vscode's Introduction

AREPL: vscode edition Build Status Downloads Downloads Gitter chat codecov

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

Alt Text

AREPL is availible for free on the vscode marketplace

Usage

First, make sure you have python 3 installed.

Open a python file and right click on the editor title for AREPL launch options.

Or run AREPL through the command search: control-shift-p

or use the shortcuts: control-shift-a (current doc) / control-shift-q (new doc)

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

STDIN

see https://github.com/Almenon/AREPL-vscode/wiki/Using-AREPL-with-input

HOWDOI

You can use howdoi with arepl:

From the terminal / command line:

pip install howdoi

Then in arepl you can use howdoi to get answers to your questions. For example:

howdoi('calculate fibbonaci in python')

will give you a function to calcualate a fibonaci number

GUIS

see https://github.com/Almenon/AREPL-vscode/wiki/Using-AREPL-with-GUI's

#$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.

Alternatively, you can use the areplStore variable to store data in between runs.

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

More Stuff: Check out the wiki!

Contributing to the project

See the wiki page on getting started. Contributions welcome!

arepl-vscode's People

Contributors

almenon avatar caleb15 avatar coder9604 avatar greenkeeper[bot] avatar yozlet avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.