- Fetch from repo:
git clone https://github.com/ethanchewy/PythonBuddy.git
- Change to directory
- Create virtualenv based on your own system:
python3 -m venv venv
- Activate vitrual environment:
- Pipe requirements to venv folder:
pip install -r requirements.txt
- Set FLASK_APP variable:
- Run flask app:
Open your browser to localhost:5000 . Voila!
- Uses Pylint as checker (only prints out errors and warnings)
- Syntax Highlighting
- Python Complilation
- Basic Sandboxing
Secure (Sandboxed) Version using Docker
This builds off of christophetd's docker-python-sandbox and just modifies it so that it runs pylint in the background and processes the pylint messages on the client side.
To see how he implements it on the web side, please check out https://github.com/christophetd/code-execution-api-demo
This is still in alpha stage so there might be some bugs. If you want to implement this please check the 4 links above since documentation is a WIP.
- Edit app.py to change any pylint options (like showing/hiding hints warnings)
- To create a much more secure Python Environment, consider using RestrictedPython: https://github.com/ethanchewy/OnlinePythonLinterSyntaxChecker/tree/restrictedpython
- For more security but enough flexibility, you could restrict the temp.py python file without read/write permissions via these instuctions: http://stackoverflow.com/questions/186202/what-is-the-best-way-to-open-a-file-for-exclusive-access-in-python
- For versions that used Python 2 or to see older versions, check: https://github.com/ethanchewy/PythonBuddy/releases
- Make easily embeddable for MOOCs like edX and other education platform
- Create an analytics system that models the student's python learning and tells them where they need improvement (many programming students learn by copying and pasting and don't actually understand the nuances of the Python language).
- Stricter Python Sandboxing via Pypy's sandboxing solution
- Lower CPU usage
- Allow users to generate a link to a unique code snippet similar to JSBin
- Unit tests for client side JS
Why did you make this?
I made this so that MOOCs like edX or codecademy could easily embed and use this on their courses so students wouldn't have to go through the frustrations of setting up a Python environment and jump right into Python programming with the support of live syntax checking & highlighting.(Programming MOOCs often have a high attrition rate due to the difficulties of setting up an environment). Also, professors and teachers could easily set up a server and allow students to quickly test out their code with PythonBuddy online.
Has anyone created anything like this before?
There has never been a live syntax checker for python online. Similar projects that are not "live" are http://pep8online.com/ and http://antares.sip.ucm.es/cesar/pylint/
Has can I contribute?
Where's the code for embedding it in MOOCs?
I'm currently working on this over here (for edx specifically): https://github.com/ethanchewy/pybuddy2.0 . If you want to embed this project directly to your site, you would use an iframe:
I want the code to actually compile and run in a certain way?
If you want to actually execute the python safely look at my Restricted Python branch: https://github.com/ethanchewy/PythonBuddy/tree/restrictedpython. If you want to run the code more quickly, check out the testing branch which uses Python 3 but may have some bugs: https://github.com/ethanchewy/PythonBuddy/tree/testing.
How do I run my own server? https://github.com/ethanchewy/OnlinePythonLinterSyntaxChecker/wiki
This was made by Ethan Chiu as a research project under the guidance of Wellesley College professor Eni Mustafaraj.
I started working on this in 2016 after seeing no one had addressed the issue of reducing the high attrition rate of beginning Python programmers due to the difficulties of setting up their programming environment.
So, ever since then, I've always been trying to improve PythonBuddy such as security and scalabitliy. Thus, I have dedicated as much as my free time into this project.
Since 2016, it's cost more than $250 per year to run and deploy the demo site excluding development costs.
Before college, I've been able to save money from various jobs. Now that I am in college, I have to pay a hefty tuition, housing, food, etc so it's much harder to sustain PythonBuddy even with a part-time job.
My goal is to keep the demo site PythonBuddy running since more than 4,000 users use it daily. All donations will go towards PythonBuddy and any excess will be used to increase the specs of the PythonBuddy demo server.
Any donation would be greatly appreciated
No donation is too small. A dollar goes a long way :)