https://github.com/3jackdaws/pycodeexec
Python library that allows for execution of arbitrary code from supported languages.
https://github.com/3jackdaws/pycodeexec
Last synced: 2 months ago
JSON representation
Python library that allows for execution of arbitrary code from supported languages.
- Host: GitHub
- URL: https://github.com/3jackdaws/pycodeexec
- Owner: 3jackdaws
- Created: 2018-11-25T22:08:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-26T07:26:13.000Z (over 7 years ago)
- Last Synced: 2025-09-25T02:49:38.794Z (9 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyCodeExec
Simple python library that can execute arbitrary code from supported programming languages via docker.
#### Requires a local Docker install
[](https://jenkins.isogen.net/job/pycodeexec/)
# Usage
### Synchronous JavaScript
```python
from pycodeexec import Runner
javascript = Runner("javascript")
output = javascript.get_output("console.log([...Array(10)].map(i=>i*i))")
print(output)
# [ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 ]
```
### Also supports Asyncio
```python
from pycodeexec.asyncio import Runner
javascript = Runner("javascript")
await javascript.is_ready()
output = await javascript.get_output("console.log([...Array(10)].map(i=>i*i))")
print(output)
# [ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 ]
```
# Supported Languages
* Python
* JavaScript
* Ruby
* C
* More to come
# Installation
```bash
pip install pycodeexec
```
# TODO
* Execution limits
* List supported languages
* Come up with better names for everything
* Stream output via generator or something
* More supported languages
# Contributing
If anyone ever reads this, adding languages is really easy and that'd be an easy way to contribute. Otherwise, submit a pull request.