Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wilig/PyLight
Python suport for Light Table like live evaluation
https://github.com/wilig/PyLight
Last synced: 3 months ago
JSON representation
Python suport for Light Table like live evaluation
- Host: GitHub
- URL: https://github.com/wilig/PyLight
- Owner: wilig
- Created: 2012-04-16T15:42:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-05-04T15:13:39.000Z (over 12 years ago)
- Last Synced: 2024-07-19T22:50:00.024Z (4 months ago)
- Language: Python
- Homepage:
- Size: 111 KB
- Stars: 26
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyLight - A Light Table backend for Python #
Update: Contribute to the development of LightTable: KickStarter - http://www.kickstarter.com/projects/306316578/light-table
Warning: Early alpha software ahead!
During my exploration of bringing the Meta II compiler to Python I was interrupted by the insanely cool Light Table demo video. If you haven't seen it, go watch it now!
Since I was already digging thru the tokenizer and compiler for Python I decided to see if I could achieve the live tracing as seen in Light Table.
The fruits of my labor is PyLight.
PyLight runs python code and prints out the substitutions as shown in the Light Table video.
*Shut up, and show me*
Simple example:
def ex1(x):
y = x * x
return y, ex2(y)def ex2(y):
return y / 3ex1(20)
(Save to test.py)
To see the substitutions for this file run it with PyLight like so:
pylight test.py
You should see the following:
def ex1(20):
y = 20 * 20
return 400, ex2(400)def ex2(400):
return 400 / 3More fun:
def fac(n):
if n <= 1:
return 1
else:
return n * fac(n - 1)fac(5)
Output:
def fac(5):
if 5 <= 1:
return 1
else:
return 5 * fac(5 - 1)def fac(4):
if 4 <= 1:
return 1
else:
return 4 * fac(4 - 1)def fac(3):
if 3 <= 1:
return 1
else:
return 3 * fac(3 - 1)def fac(2):
if 2 <= 1:
return 1
else:
return 2 * fac(2 - 1)def fac(1):
if 1 <= 1:
return 1
else:
return n * fac(n - 1)## Known issues ##
* Class handling is quite ugly
* Functions with internal iteration currently only show the final result of the iteration.## Next steps ##
* Fix class handling
* Show internal iteration properly for some value of properly
* Chase down endless edge cases
* Add support to pull out a call graph for a function [in progress]## Call for help ##
There are endless bugs to discover and fix. If you are so inclined please roll up your sleeves and get to work.