Read Evaluate Print in Comments
Project description
Intro
REPIC is a Python function that will let you print output to comments inside the current file. It stands for Read, Evaluate, Print In Comments.
Install
Install Python 2.7.x and then in the terminal install via:
pip install REPIC
Usage Example
Given a file test.py with the following content:
from REPIC import REPIC
test = [1,2,3] + [4,5,6]
REPIC(test)
After running the contents of test.py become:
from REPIC import REPIC
test = [1,2,3] + [4,5,6]
REPIC(test)#OUTPUT: [1,2,3,4,5,6]
Why
Why in the world did I build this? I'm a huge fan or REPLs, but it's hard to save the output from them and go back and edit it later. iPython is great, it's probably the environment I develop Python in fastest, but with all the HTML and javascript frontend there's a lot of dependencies and new interfaces. REPIC lets you stay in your text editor or terminal environment and still get that convenient combination of code and output.
This library works great with Python 2.7 files edited with Sublime text. You run the file and the output shows up immediately. This might not be the case in every editor and Python environment since this code uses a lot of hackish features.
Thanks
iPython was a big inspiration, and its repl sessions can be saved if you prefer that kind of interface.
Thanks to users on stackoverflow for info on how to pull line numbers out of currently executing code. Thanks also to this thread discussing in-place rewrites of files in Python.
On a more philosophical level, this was inspired by Don Knuth's literate programming, REPLs, and what appears to be the first "Notebook" interface tweak to the REPL in Mathematica.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file REPIC-1.3.tar.gz
.
File metadata
- Download URL: REPIC-1.3.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f6e9cfe3a8073f8b41e82fe3ee4dab70aaad01eba73ed7d9a81f486cf623ff0 |
|
MD5 | 36615a038bddcaf96a2ce47e5fed5ffe |
|
BLAKE2b-256 | 974df0ddf8f5dc64ec623cb8046cabc34f58c67f0415c5e6496ff78298f70a1c |