{"id":21986174,"url":"https://github.com/cassanof/code_exec_server","last_synced_at":"2025-04-30T08:06:36.571Z","repository":{"id":184721756,"uuid":"672367822","full_name":"cassanof/code_exec_server","owner":"cassanof","description":"A Containerized Server To Execute Python (and other languages) Code","archived":false,"fork":false,"pushed_at":"2024-07-19T19:32:43.000Z","size":75,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-07-20T00:41:03.010Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cassanof.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-29T20:46:37.000Z","updated_at":"2024-07-19T19:32:46.000Z","dependencies_parsed_at":"2024-05-15T16:36:38.373Z","dependency_job_id":"ed29eb74-94a8-40b1-9972-b8bdf66d1171","html_url":"https://github.com/cassanof/code_exec_server","commit_stats":null,"previous_names":["cassanof/python_code_exec_server","cassanof/code_exec_server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cassanof%2Fcode_exec_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cassanof%2Fcode_exec_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cassanof%2Fcode_exec_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cassanof%2Fcode_exec_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cassanof","download_url":"https://codeload.github.com/cassanof/code_exec_server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227185398,"owners_count":17744371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T18:17:16.630Z","updated_at":"2024-11-29T18:17:17.158Z","avatar_url":"https://github.com/cassanof.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Containerized Server To Execute Code Remotely\n\nRuns a dockerized server that allows you to execute Python code via HTTP requests.\nAll the Python code executions will run concurrently; the server will not block any requests.\nThis means that the server will not wait for the execution of the Python code to finish before accepting new requests.\n\n**Make sure to init the submodules before running the server:** `git submodule update --init --recursive`\n\n## Running the Server\n\nTo run the server, you need to have Docker installed on your machine (preferably with the [gVisor runtime](https://gvisor.dev/docs/) for security reasons).\nThen, you can just use the `./build_and_run.sh` script to build the container\nand run the server on your machine.\nAlternatively, you can use `./pull_and_run.sh` to pull the container from Docker Hub instead of building it.\n\nIf you are feeling dangerous, you can also just run the server\ndirectly with `./run.sh`. You'll need rust installed on your machine to compile the server along\nwith whatever runtime the language of the code you want to execute requires.\n\n#### Increase Open File Limit\n\nIf you plan to run crazy amounts of code in parallel, you might want to increase the open file limit of your machine:\n\n```bash\nsudo sysctl -w fs.file-max=1000000\nulimit -n 1000000\n```\n\n### Calling the Server\n\nWe provide a simple Python library to interact with the server, which you can find in the `./code_exec_reqs.py` file.\nThe server runs on port `8000`, so you can call it from `http://127.0.0.1:8000`.\n\nYou can also use whatever http client to interact with the server. There are three endpoints:\n\n- `/py_exec`: executes Python code. Expects a json with field `code` containing the Python code to be executed.\n- `/any_exec`: executes code in any language. Expects a json with fields `code` containing the code to be executed and `lang` containing the language of the program.\n  See list of supported languages below.\n  It's preferred to run python with the `/py_exec` endpoint, as it doesn't have the overhead of running MultiPL-E evaluators.\n- `/py_coverage`: executes the Python code and returns the coverage of the code. Expects a json with field `code` containing the Python code to be executed.\n\nBoth `/py_exec` and `/any_exec` will return the exit code of the program, followed by the stdout and stderr of the program after the newline character.\n\n## Other Languages\n\nYes! The server supports about 29 languages:\n\n- clj\n- cpp\n- cs\n- dfy\n- dlang\n- elixir\n- fs\n- go\n- hs\n- java\n- javascript\n- julia\n- lean\n- lua\n- luau\n- matlab\n- ocaml\n- php\n- pl\n- python\n- racket\n- r\n- ruby\n- rust\n- scala\n- sh\n- swift\n- ts\n- v\n\nThis is thanks to the MultiPL-E evaluators, check them out [here](https://github.com/nuprl/MultiPL-E).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcassanof%2Fcode_exec_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcassanof%2Fcode_exec_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcassanof%2Fcode_exec_server/lists"}