runcode 0.1__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runcode-0.3.0/.gitignore +3 -0
- runcode-0.3.0/LICENSE +21 -0
- runcode-0.3.0/PKG-INFO +74 -0
- runcode-0.3.0/README.md +56 -0
- runcode-0.3.0/pyproject.toml +31 -0
- runcode-0.3.0/src/runcode/__init__.py +83 -0
- runcode-0.3.0/tests/test_runner.py +102 -0
- runcode-0.3.0/uv.lock +22 -0
- runcode-0.1/PKG-INFO +0 -102
- runcode-0.1/README.md +0 -79
- runcode-0.1/runcode/__init__.py +0 -1
- runcode-0.1/runcode/runner.py +0 -73
- runcode-0.1/runcode.egg-info/PKG-INFO +0 -102
- runcode-0.1/runcode.egg-info/SOURCES.txt +0 -15
- runcode-0.1/runcode.egg-info/dependency_links.txt +0 -1
- runcode-0.1/runcode.egg-info/requires.txt +0 -1
- runcode-0.1/runcode.egg-info/top_level.txt +0 -2
- runcode-0.1/runcode_sample/__init__.py +0 -0
- runcode-0.1/runcode_sample/asgi.py +0 -16
- runcode-0.1/runcode_sample/settings.py +0 -120
- runcode-0.1/runcode_sample/urls.py +0 -9
- runcode-0.1/runcode_sample/views.py +0 -31
- runcode-0.1/runcode_sample/wsgi.py +0 -16
- runcode-0.1/setup.cfg +0 -4
- runcode-0.1/setup.py +0 -39
runcode-0.3.0/.gitignore
ADDED
runcode-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RunCode Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
runcode-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: runcode
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: runcode is now onlinecompiler: this release keeps runcode.Runner working through the OnlineCompiler.io client
|
|
5
|
+
Project-URL: Homepage, https://onlinecompiler.io
|
|
6
|
+
Project-URL: Documentation, https://pypi.org/project/onlinecompiler/
|
|
7
|
+
Author: RunCode Inc.
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: code execution,compiler api,online compiler,onlinecompiler,runcode
|
|
11
|
+
Classifier: Development Status :: 7 - Inactive
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: onlinecompiler>=0.1.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# runcode is now onlinecompiler
|
|
20
|
+
|
|
21
|
+
RunCode's code execution API is now [OnlineCompiler.io](https://onlinecompiler.io/?utm_source=pypi-runcode),
|
|
22
|
+
and its Python client is [`onlinecompiler`](https://pypi.org/project/onlinecompiler/). New code should
|
|
23
|
+
use it:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install onlinecompiler
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from onlinecompiler import OnlineCompiler
|
|
31
|
+
|
|
32
|
+
client = OnlineCompiler() # reads ONLINECOMPILER_API_KEY
|
|
33
|
+
|
|
34
|
+
result = client.run("python-3.14", "name = input()\nprint(f'Hello, {name}!')", input="Ada")
|
|
35
|
+
print(result["output"]) # Hello, Ada!
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
It runs code in 46 languages and judges it against test cases, and it is free up to 100,000 runs a
|
|
39
|
+
month. Get an API key at https://api.onlinecompiler.io/compilers/api-keys/.
|
|
40
|
+
|
|
41
|
+
## Code written for runcode 0.2.1
|
|
42
|
+
|
|
43
|
+
runcode 0.2.1 sent runs to app.runcode.io, which no longer answers. This release keeps the same
|
|
44
|
+
`Runner` working through `onlinecompiler`, so old code runs again after `pip install -U runcode`:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from runcode import Runner
|
|
48
|
+
|
|
49
|
+
runner = Runner(api_key="YOUR_ONLINECOMPILER_API_KEY")
|
|
50
|
+
queued = runner.execute(code="print(input())", input="hi", compiler=Runner.python39)
|
|
51
|
+
print(queued["id"])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
What changed:
|
|
55
|
+
|
|
56
|
+
- The API key is an OnlineCompiler.io key. Without one, `Runner()` reads Django's
|
|
57
|
+
`settings.RUNCODE_API_KEY` as before, then the `ONLINECOMPILER_API_KEY` environment variable.
|
|
58
|
+
- Results are POSTed to the callback URL set on your API key in the
|
|
59
|
+
[dashboard](https://api.onlinecompiler.io/compilers/api-keys/), with `extra_params` echoed back.
|
|
60
|
+
Set one there first: a key without a callback URL is refused. A `callback_url` passed to `Runner`
|
|
61
|
+
(or `RUNCODE_CALLBACK_URL`) is not sent, and `Runner` warns.
|
|
62
|
+
- `execute` returns `{"status": ..., "id": ...}` for the queued run, and raises
|
|
63
|
+
`onlinecompiler.OnlineCompilerError` when the run is refused (a bad key, a limit), where 0.2.1
|
|
64
|
+
returned nothing.
|
|
65
|
+
- The old compiler ids run on current versions: `python39` on Python 3.14, `gcc49` on GCC 15,
|
|
66
|
+
`cpp49` on G++ 15, `openjdk11` on OpenJDK 25, `dotnet5` on C# (.NET 10), `php81` on PHP 8.5,
|
|
67
|
+
`fsharp5` on F# (.NET 10) and `ruby30` on Ruby 4.0. Python 2.7 (`python27`) is no longer offered
|
|
68
|
+
and raises `ValueError`. Any current compiler id works too, such as `"rust-1.93"`; the full list is
|
|
69
|
+
at https://onlinecompiler.io/languages.
|
|
70
|
+
- Python 3.10 or newer, and no `requests` dependency. The Django sample project is gone.
|
|
71
|
+
|
|
72
|
+
`Runner` shows a `DeprecationWarning`. To get results in the response, judge against test cases,
|
|
73
|
+
verify webhooks and more, move to `OnlineCompiler`: see the
|
|
74
|
+
[onlinecompiler README](https://pypi.org/project/onlinecompiler/).
|
runcode-0.3.0/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# runcode is now onlinecompiler
|
|
2
|
+
|
|
3
|
+
RunCode's code execution API is now [OnlineCompiler.io](https://onlinecompiler.io/?utm_source=pypi-runcode),
|
|
4
|
+
and its Python client is [`onlinecompiler`](https://pypi.org/project/onlinecompiler/). New code should
|
|
5
|
+
use it:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install onlinecompiler
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from onlinecompiler import OnlineCompiler
|
|
13
|
+
|
|
14
|
+
client = OnlineCompiler() # reads ONLINECOMPILER_API_KEY
|
|
15
|
+
|
|
16
|
+
result = client.run("python-3.14", "name = input()\nprint(f'Hello, {name}!')", input="Ada")
|
|
17
|
+
print(result["output"]) # Hello, Ada!
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It runs code in 46 languages and judges it against test cases, and it is free up to 100,000 runs a
|
|
21
|
+
month. Get an API key at https://api.onlinecompiler.io/compilers/api-keys/.
|
|
22
|
+
|
|
23
|
+
## Code written for runcode 0.2.1
|
|
24
|
+
|
|
25
|
+
runcode 0.2.1 sent runs to app.runcode.io, which no longer answers. This release keeps the same
|
|
26
|
+
`Runner` working through `onlinecompiler`, so old code runs again after `pip install -U runcode`:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from runcode import Runner
|
|
30
|
+
|
|
31
|
+
runner = Runner(api_key="YOUR_ONLINECOMPILER_API_KEY")
|
|
32
|
+
queued = runner.execute(code="print(input())", input="hi", compiler=Runner.python39)
|
|
33
|
+
print(queued["id"])
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
What changed:
|
|
37
|
+
|
|
38
|
+
- The API key is an OnlineCompiler.io key. Without one, `Runner()` reads Django's
|
|
39
|
+
`settings.RUNCODE_API_KEY` as before, then the `ONLINECOMPILER_API_KEY` environment variable.
|
|
40
|
+
- Results are POSTed to the callback URL set on your API key in the
|
|
41
|
+
[dashboard](https://api.onlinecompiler.io/compilers/api-keys/), with `extra_params` echoed back.
|
|
42
|
+
Set one there first: a key without a callback URL is refused. A `callback_url` passed to `Runner`
|
|
43
|
+
(or `RUNCODE_CALLBACK_URL`) is not sent, and `Runner` warns.
|
|
44
|
+
- `execute` returns `{"status": ..., "id": ...}` for the queued run, and raises
|
|
45
|
+
`onlinecompiler.OnlineCompilerError` when the run is refused (a bad key, a limit), where 0.2.1
|
|
46
|
+
returned nothing.
|
|
47
|
+
- The old compiler ids run on current versions: `python39` on Python 3.14, `gcc49` on GCC 15,
|
|
48
|
+
`cpp49` on G++ 15, `openjdk11` on OpenJDK 25, `dotnet5` on C# (.NET 10), `php81` on PHP 8.5,
|
|
49
|
+
`fsharp5` on F# (.NET 10) and `ruby30` on Ruby 4.0. Python 2.7 (`python27`) is no longer offered
|
|
50
|
+
and raises `ValueError`. Any current compiler id works too, such as `"rust-1.93"`; the full list is
|
|
51
|
+
at https://onlinecompiler.io/languages.
|
|
52
|
+
- Python 3.10 or newer, and no `requests` dependency. The Django sample project is gone.
|
|
53
|
+
|
|
54
|
+
`Runner` shows a `DeprecationWarning`. To get results in the response, judge against test cases,
|
|
55
|
+
verify webhooks and more, move to `OnlineCompiler`: see the
|
|
56
|
+
[onlinecompiler README](https://pypi.org/project/onlinecompiler/).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "runcode"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "runcode is now onlinecompiler: this release keeps runcode.Runner working through the OnlineCompiler.io client"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "RunCode Inc." }]
|
|
14
|
+
keywords = ["code execution", "online compiler", "compiler api", "runcode", "onlinecompiler"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 7 - Inactive",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["onlinecompiler>=0.1.0"]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://onlinecompiler.io"
|
|
25
|
+
Documentation = "https://pypi.org/project/onlinecompiler/"
|
|
26
|
+
|
|
27
|
+
[tool.hatch.version]
|
|
28
|
+
path = "src/runcode/__init__.py"
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
packages = ["src/runcode"]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""runcode is now onlinecompiler. This release keeps runcode.Runner working through the onlinecompiler client.
|
|
2
|
+
|
|
3
|
+
New code should use the client directly:
|
|
4
|
+
|
|
5
|
+
from onlinecompiler import OnlineCompiler
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import warnings
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from onlinecompiler import OnlineCompiler, Queued
|
|
14
|
+
|
|
15
|
+
__version__ = "0.3.0"
|
|
16
|
+
__all__ = ["Runner", "OnlineCompiler"]
|
|
17
|
+
|
|
18
|
+
# The compiler ids runcode 0.2.1 offered, mapped to the current version of each language.
|
|
19
|
+
# None means the language is no longer offered.
|
|
20
|
+
_CURRENT_IDS: dict[str, str | None] = {
|
|
21
|
+
"python-3.9.7": "python-3.14",
|
|
22
|
+
"gcc-4.9": "gcc-15",
|
|
23
|
+
"g++-4.9": "g++-15",
|
|
24
|
+
"openjdk-11": "openjdk-25",
|
|
25
|
+
"dotnet-5": "dotnet-csharp-10",
|
|
26
|
+
"python-2.7.18": None,
|
|
27
|
+
"php-8.1": "php-8.5",
|
|
28
|
+
"fsharp-5": "dotnet-fsharp-10",
|
|
29
|
+
"ruby-3.0.2": "ruby-4.0",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Runner:
|
|
34
|
+
"""The runcode 0.2.1 API, sent through onlinecompiler's queued run (POST /api/run-code/)."""
|
|
35
|
+
|
|
36
|
+
python39 = "python-3.9.7"
|
|
37
|
+
gcc49 = "gcc-4.9"
|
|
38
|
+
cpp49 = "g++-4.9"
|
|
39
|
+
openjdk11 = "openjdk-11"
|
|
40
|
+
dotnet5 = "dotnet-5"
|
|
41
|
+
python27 = "python-2.7.18"
|
|
42
|
+
php81 = "php-8.1"
|
|
43
|
+
fsharp5 = "fsharp-5"
|
|
44
|
+
ruby30 = "ruby-3.0.2"
|
|
45
|
+
|
|
46
|
+
def __init__(self, api_key: str = "", callback_url: str = ""):
|
|
47
|
+
"""api_key defaults to Django's settings.RUNCODE_API_KEY, as before, then to the
|
|
48
|
+
ONLINECOMPILER_API_KEY environment variable. Get a key at https://onlinecompiler.io."""
|
|
49
|
+
warnings.warn(
|
|
50
|
+
"runcode is now onlinecompiler: use `from onlinecompiler import OnlineCompiler`. "
|
|
51
|
+
"runcode.Runner keeps working through it.",
|
|
52
|
+
DeprecationWarning,
|
|
53
|
+
stacklevel=2,
|
|
54
|
+
)
|
|
55
|
+
if not api_key:
|
|
56
|
+
try:
|
|
57
|
+
from django.conf import settings
|
|
58
|
+
|
|
59
|
+
api_key = getattr(settings, "RUNCODE_API_KEY", "") or ""
|
|
60
|
+
callback_url = callback_url or getattr(settings, "RUNCODE_CALLBACK_URL", "") or ""
|
|
61
|
+
except Exception:
|
|
62
|
+
pass
|
|
63
|
+
self.api_key = api_key
|
|
64
|
+
self.callback_url = callback_url
|
|
65
|
+
if callback_url:
|
|
66
|
+
warnings.warn(
|
|
67
|
+
"callback_url is not sent: results go to the callback URL set on your API key in the "
|
|
68
|
+
"onlinecompiler.io dashboard.",
|
|
69
|
+
UserWarning,
|
|
70
|
+
stacklevel=2,
|
|
71
|
+
)
|
|
72
|
+
self.client = OnlineCompiler(api_key or None)
|
|
73
|
+
|
|
74
|
+
def execute(self, code: str, input: str, compiler: str, extra_params: dict[str, Any] | None = None) -> Queued:
|
|
75
|
+
"""Queue a run and return at once with its id ({"status": ..., "id": ...}). The result is
|
|
76
|
+
POSTed to the callback URL set on your API key in the onlinecompiler.io dashboard, with
|
|
77
|
+
extra_params echoed back. Raises onlinecompiler.OnlineCompilerError if the run is refused."""
|
|
78
|
+
if compiler in _CURRENT_IDS:
|
|
79
|
+
current = _CURRENT_IDS[compiler]
|
|
80
|
+
if current is None:
|
|
81
|
+
raise ValueError(f"{compiler} is no longer offered. Runner.python39 runs Python 3.14.")
|
|
82
|
+
compiler = current
|
|
83
|
+
return self.client.submit(compiler, code, input, extra_params=extra_params or None)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import types
|
|
4
|
+
import unittest
|
|
5
|
+
import warnings
|
|
6
|
+
from unittest import mock
|
|
7
|
+
|
|
8
|
+
from onlinecompiler import OnlineCompiler
|
|
9
|
+
|
|
10
|
+
import runcode
|
|
11
|
+
from runcode import Runner
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def quiet_runner(*args, **kwargs):
|
|
15
|
+
with warnings.catch_warnings():
|
|
16
|
+
warnings.simplefilter("ignore")
|
|
17
|
+
return Runner(*args, **kwargs)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RunnerTests(unittest.TestCase):
|
|
21
|
+
def setUp(self):
|
|
22
|
+
sent = []
|
|
23
|
+
|
|
24
|
+
def fake_submit(client, compiler, code, input="", **kwargs):
|
|
25
|
+
sent.append({"key": client.api_key, "compiler": compiler, "code": code, "input": input, **kwargs})
|
|
26
|
+
return {"status": "queued", "id": 7}
|
|
27
|
+
|
|
28
|
+
patcher = mock.patch.object(OnlineCompiler, "submit", fake_submit)
|
|
29
|
+
patcher.start()
|
|
30
|
+
self.addCleanup(patcher.stop)
|
|
31
|
+
self.sent = sent
|
|
32
|
+
|
|
33
|
+
def test_execute_queues_the_run_with_the_old_signature(self):
|
|
34
|
+
runner = quiet_runner(api_key="k1")
|
|
35
|
+
answer = runner.execute(code="print(input())", input="hi", compiler=Runner.python39, extra_params={"ukey": "16"})
|
|
36
|
+
self.assertEqual(answer, {"status": "queued", "id": 7})
|
|
37
|
+
self.assertEqual(
|
|
38
|
+
self.sent,
|
|
39
|
+
[{"key": "k1", "compiler": "python-3.14", "code": "print(input())", "input": "hi",
|
|
40
|
+
"extra_params": {"ukey": "16"}}],
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def test_every_old_id_maps_to_a_current_one_except_python2(self):
|
|
44
|
+
expected = {
|
|
45
|
+
Runner.python39: "python-3.14",
|
|
46
|
+
Runner.gcc49: "gcc-15",
|
|
47
|
+
Runner.cpp49: "g++-15",
|
|
48
|
+
Runner.openjdk11: "openjdk-25",
|
|
49
|
+
Runner.dotnet5: "dotnet-csharp-10",
|
|
50
|
+
Runner.php81: "php-8.5",
|
|
51
|
+
Runner.fsharp5: "dotnet-fsharp-10",
|
|
52
|
+
Runner.ruby30: "ruby-4.0",
|
|
53
|
+
}
|
|
54
|
+
runner = quiet_runner(api_key="k1")
|
|
55
|
+
for old, current in expected.items():
|
|
56
|
+
runner.execute("x", "", old)
|
|
57
|
+
self.assertEqual(self.sent[-1]["compiler"], current)
|
|
58
|
+
with self.assertRaisesRegex(ValueError, "no longer offered"):
|
|
59
|
+
runner.execute("print 1", "", Runner.python27)
|
|
60
|
+
|
|
61
|
+
def test_current_ids_pass_through(self):
|
|
62
|
+
quiet_runner(api_key="k1").execute("fn main() {}", "", "rust-1.93")
|
|
63
|
+
self.assertEqual(self.sent[-1]["compiler"], "rust-1.93")
|
|
64
|
+
|
|
65
|
+
def test_no_extra_params_sends_none(self):
|
|
66
|
+
quiet_runner(api_key="k1").execute("x", "", "python-3.14")
|
|
67
|
+
self.assertIsNone(self.sent[-1]["extra_params"])
|
|
68
|
+
|
|
69
|
+
def test_constructing_warns_that_runcode_is_now_onlinecompiler(self):
|
|
70
|
+
with self.assertWarnsRegex(DeprecationWarning, "runcode is now onlinecompiler"):
|
|
71
|
+
Runner(api_key="k1")
|
|
72
|
+
|
|
73
|
+
def test_a_callback_url_is_not_sent_and_warns(self):
|
|
74
|
+
with warnings.catch_warnings(record=True) as caught:
|
|
75
|
+
warnings.simplefilter("always")
|
|
76
|
+
runner = Runner(api_key="k1", callback_url="https://example.com/hook")
|
|
77
|
+
self.assertTrue(any(issubclass(w.category, UserWarning) and "callback_url is not sent" in str(w.message)
|
|
78
|
+
for w in caught))
|
|
79
|
+
runner.execute("x", "", "python-3.14")
|
|
80
|
+
self.assertNotIn("callback_url", self.sent[-1])
|
|
81
|
+
|
|
82
|
+
def test_without_a_key_it_reads_django_settings_then_the_environment(self):
|
|
83
|
+
settings = types.SimpleNamespace(RUNCODE_API_KEY="from-django", RUNCODE_CALLBACK_URL="")
|
|
84
|
+
django = types.ModuleType("django")
|
|
85
|
+
conf = types.ModuleType("django.conf")
|
|
86
|
+
conf.settings = settings
|
|
87
|
+
django.conf = conf
|
|
88
|
+
with mock.patch.dict(sys.modules, {"django": django, "django.conf": conf}):
|
|
89
|
+
quiet_runner().execute("x", "", "python-3.14")
|
|
90
|
+
self.assertEqual(self.sent[-1]["key"], "from-django")
|
|
91
|
+
|
|
92
|
+
with mock.patch.dict(sys.modules, {"django": None, "django.conf": None}), \
|
|
93
|
+
mock.patch.dict(os.environ, {"ONLINECOMPILER_API_KEY": "from-env"}):
|
|
94
|
+
quiet_runner().execute("x", "", "python-3.14")
|
|
95
|
+
self.assertEqual(self.sent[-1]["key"], "from-env")
|
|
96
|
+
|
|
97
|
+
def test_version(self):
|
|
98
|
+
self.assertEqual(runcode.__version__, "0.3.0")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
unittest.main()
|
runcode-0.3.0/uv.lock
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
version = 1
|
|
2
|
+
revision = 3
|
|
3
|
+
requires-python = ">=3.10"
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "onlinecompiler"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
source = { registry = "https://pypi.org/simple" }
|
|
9
|
+
sdist = { url = "https://files.pythonhosted.org/packages/32/bf/368266b912ddeb8dbd8c378c3a5268041361193e29e5d6f2172146a4f04d/onlinecompiler-0.1.0.tar.gz", hash = "sha256:2942456ed41b1e06f551a1db460ddc887a0c401e4bc17c67a3575ad0fc698fa8", size = 43885, upload-time = "2026-11-05T17:11:36.642Z" }
|
|
10
|
+
wheels = [
|
|
11
|
+
{ url = "https://files.pythonhosted.org/packages/92/86/eef0c121d6fa903fe9bec14979b505ff6a652032b5a8d01d560f70ec23ce/onlinecompiler-0.1.0-py3-none-any.whl", hash = "sha256:120d45394b3c8193e26b34e6a2a4de5940735fcd186cc3214ea6d34eeacbe32b", size = 19226, upload-time = "2026-11-05T17:11:35.514Z" },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "runcode"
|
|
16
|
+
source = { editable = "." }
|
|
17
|
+
dependencies = [
|
|
18
|
+
{ name = "onlinecompiler" },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[package.metadata]
|
|
22
|
+
requires-dist = [{ name = "onlinecompiler", specifier = ">=0.1.0" }]
|
runcode-0.1/PKG-INFO
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: runcode
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: RunCode Python API
|
|
5
|
-
Home-page: https://github.com/runcode-io/runcode-python
|
|
6
|
-
Author: Micro Pyramid Informatic Pvt. Ltd.
|
|
7
|
-
Author-email: hello@micropyramid.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Description: # RunCode Python API
|
|
10
|
-
|
|
11
|
-
This API is as simaple as send your code and getting execution result.
|
|
12
|
-
|
|
13
|
-
Install
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
pip install runcode
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Python Example
|
|
22
|
-
```
|
|
23
|
-
from runcode import Runner
|
|
24
|
-
|
|
25
|
-
runner = Runner(
|
|
26
|
-
api_key="",
|
|
27
|
-
callback_url="",
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
runner.execute(
|
|
31
|
-
code="""
|
|
32
|
-
print("Hello world")
|
|
33
|
-
start = input()
|
|
34
|
-
end = input()
|
|
35
|
-
for i in range(int(start), int(end)):
|
|
36
|
-
print(i)
|
|
37
|
-
""",
|
|
38
|
-
input="1\n10",
|
|
39
|
-
compiler=Runner.python39,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
You need to provide two parameters here.
|
|
44
|
-
api_key - you will get it from runcode.io dashboard after loging.
|
|
45
|
-
callback_url - Your application URL to process execution result.
|
|
46
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
47
|
-
## Django Example
|
|
48
|
-
```
|
|
49
|
-
from runcode import Runner
|
|
50
|
-
|
|
51
|
-
runner = Runner()
|
|
52
|
-
|
|
53
|
-
runner.execute(
|
|
54
|
-
code="""
|
|
55
|
-
print("Hello world")
|
|
56
|
-
start = input()
|
|
57
|
-
end = input()
|
|
58
|
-
for i in range(int(start), int(end)):
|
|
59
|
-
print(i)
|
|
60
|
-
""",
|
|
61
|
-
input="1\n10",
|
|
62
|
-
compiler=Runner.python39,
|
|
63
|
-
)
|
|
64
|
-
```
|
|
65
|
-
You need to specify compiler here.
|
|
66
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
67
|
-
|
|
68
|
-
You need to add two parameters to settings.py file.
|
|
69
|
-
|
|
70
|
-
RUNCODE_API_KEY - you will get it from runcode.io dashboard after loging.
|
|
71
|
-
RUNCODE_CALLBACK_URL - Your application URL to process execution result.
|
|
72
|
-
|
|
73
|
-
### Available compilers
|
|
74
|
-
```
|
|
75
|
-
python39 = "python-3.9.7"
|
|
76
|
-
gcc49 = "gcc-4.9"
|
|
77
|
-
cpp49 = "g++-4.9"
|
|
78
|
-
openjdk11 = "openjdk-11"
|
|
79
|
-
dotnet5 = "dotnet-5"
|
|
80
|
-
python27 = "python-2.7.18"
|
|
81
|
-
php81 = "php-8.1"
|
|
82
|
-
fsharp5 = "fsharp-5"
|
|
83
|
-
ruby30 = "ruby-3.0.2"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
For further support, contact hello@runcode.io
|
|
88
|
-
|
|
89
|
-
Platform: UNKNOWN
|
|
90
|
-
Classifier: Intended Audience :: Developers
|
|
91
|
-
Classifier: Operating System :: OS Independent
|
|
92
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
93
|
-
Classifier: Programming Language :: Python
|
|
94
|
-
Classifier: Programming Language :: Python :: 3
|
|
95
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
96
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
97
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
98
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
99
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
100
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
101
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
102
|
-
Description-Content-Type: text/markdown
|
runcode-0.1/README.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# RunCode Python API
|
|
2
|
-
|
|
3
|
-
This API is as simaple as send your code and getting execution result.
|
|
4
|
-
|
|
5
|
-
Install
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
pip install runcode
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Python Example
|
|
14
|
-
```
|
|
15
|
-
from runcode import Runner
|
|
16
|
-
|
|
17
|
-
runner = Runner(
|
|
18
|
-
api_key="",
|
|
19
|
-
callback_url="",
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
runner.execute(
|
|
23
|
-
code="""
|
|
24
|
-
print("Hello world")
|
|
25
|
-
start = input()
|
|
26
|
-
end = input()
|
|
27
|
-
for i in range(int(start), int(end)):
|
|
28
|
-
print(i)
|
|
29
|
-
""",
|
|
30
|
-
input="1\n10",
|
|
31
|
-
compiler=Runner.python39,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
You need to provide two parameters here.
|
|
36
|
-
api_key - you will get it from runcode.io dashboard after loging.
|
|
37
|
-
callback_url - Your application URL to process execution result.
|
|
38
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
39
|
-
## Django Example
|
|
40
|
-
```
|
|
41
|
-
from runcode import Runner
|
|
42
|
-
|
|
43
|
-
runner = Runner()
|
|
44
|
-
|
|
45
|
-
runner.execute(
|
|
46
|
-
code="""
|
|
47
|
-
print("Hello world")
|
|
48
|
-
start = input()
|
|
49
|
-
end = input()
|
|
50
|
-
for i in range(int(start), int(end)):
|
|
51
|
-
print(i)
|
|
52
|
-
""",
|
|
53
|
-
input="1\n10",
|
|
54
|
-
compiler=Runner.python39,
|
|
55
|
-
)
|
|
56
|
-
```
|
|
57
|
-
You need to specify compiler here.
|
|
58
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
59
|
-
|
|
60
|
-
You need to add two parameters to settings.py file.
|
|
61
|
-
|
|
62
|
-
RUNCODE_API_KEY - you will get it from runcode.io dashboard after loging.
|
|
63
|
-
RUNCODE_CALLBACK_URL - Your application URL to process execution result.
|
|
64
|
-
|
|
65
|
-
### Available compilers
|
|
66
|
-
```
|
|
67
|
-
python39 = "python-3.9.7"
|
|
68
|
-
gcc49 = "gcc-4.9"
|
|
69
|
-
cpp49 = "g++-4.9"
|
|
70
|
-
openjdk11 = "openjdk-11"
|
|
71
|
-
dotnet5 = "dotnet-5"
|
|
72
|
-
python27 = "python-2.7.18"
|
|
73
|
-
php81 = "php-8.1"
|
|
74
|
-
fsharp5 = "fsharp-5"
|
|
75
|
-
ruby30 = "ruby-3.0.2"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
For further support, contact hello@runcode.io
|
runcode-0.1/runcode/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .runner import Runner
|
runcode-0.1/runcode/runner.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class Runner:
|
|
5
|
-
|
|
6
|
-
python39 = "python-3.9.7"
|
|
7
|
-
gcc49 = "gcc-4.9"
|
|
8
|
-
cpp49 = "g++-4.9"
|
|
9
|
-
openjdk11 = "openjdk-11"
|
|
10
|
-
dotnet5 = "dotnet-5"
|
|
11
|
-
python27 = "python-2.7.18"
|
|
12
|
-
php81 = "php-8.1"
|
|
13
|
-
fsharp5 = "fsharp-5"
|
|
14
|
-
ruby30 = "ruby-3.0.2"
|
|
15
|
-
|
|
16
|
-
def __init__(self, api_key="", callback_url=""):
|
|
17
|
-
"""
|
|
18
|
-
Constructs and sends a :class:`Runner <Runner>`.
|
|
19
|
-
:param api_key: API Key to autheticate and process your request. You can get it in runcode.io dashboard.
|
|
20
|
-
:param callback_url: URL to receive executon results.
|
|
21
|
-
:return: :class:`Runner <Runner>` object
|
|
22
|
-
:rtype: runcode.Runner
|
|
23
|
-
Usage::
|
|
24
|
-
>>> from runcode import Runner
|
|
25
|
-
>>> runner = Runner(
|
|
26
|
-
api_key="{API_KEY}",
|
|
27
|
-
callback_url="{URL_TO_PROCESS_RESULT}",
|
|
28
|
-
)
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
if api_key == "":
|
|
32
|
-
try:
|
|
33
|
-
from django.conf import settings
|
|
34
|
-
|
|
35
|
-
self.api_key = settings.RUNCODE_API_KEY
|
|
36
|
-
self.callback_url = settings.RUNCODE_CALLBACK_URL
|
|
37
|
-
except:
|
|
38
|
-
pass
|
|
39
|
-
else:
|
|
40
|
-
self.api_key = api_key
|
|
41
|
-
self.callback_url = callback_url
|
|
42
|
-
|
|
43
|
-
def execute(self, code, input, compiler):
|
|
44
|
-
"""
|
|
45
|
-
Sends code and input to be executed by runcode platform.
|
|
46
|
-
:param code: Code to get executed.
|
|
47
|
-
:param input: input values for the code.
|
|
48
|
-
:compiler: Compiler to use to execute the code.
|
|
49
|
-
Usage::
|
|
50
|
-
>>> runner.execute(
|
|
51
|
-
code='''
|
|
52
|
-
print("Hello world")
|
|
53
|
-
start = input()
|
|
54
|
-
end = input()
|
|
55
|
-
for i in range(int(start), int(end)):
|
|
56
|
-
print(i)
|
|
57
|
-
''',
|
|
58
|
-
input="1\n10",
|
|
59
|
-
compiler=Runner.python39,
|
|
60
|
-
)
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
|
64
|
-
|
|
65
|
-
out = {
|
|
66
|
-
"api_key": self.api_key,
|
|
67
|
-
"code": code,
|
|
68
|
-
"input": input,
|
|
69
|
-
"compiler": compiler,
|
|
70
|
-
"callback_url": self.callback_url,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
r = requests.post("https://runcode.io/api/run-code/", data=out, headers=headers)
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: runcode
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: RunCode Python API
|
|
5
|
-
Home-page: https://github.com/runcode-io/runcode-python
|
|
6
|
-
Author: Micro Pyramid Informatic Pvt. Ltd.
|
|
7
|
-
Author-email: hello@micropyramid.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Description: # RunCode Python API
|
|
10
|
-
|
|
11
|
-
This API is as simaple as send your code and getting execution result.
|
|
12
|
-
|
|
13
|
-
Install
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
pip install runcode
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Python Example
|
|
22
|
-
```
|
|
23
|
-
from runcode import Runner
|
|
24
|
-
|
|
25
|
-
runner = Runner(
|
|
26
|
-
api_key="",
|
|
27
|
-
callback_url="",
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
runner.execute(
|
|
31
|
-
code="""
|
|
32
|
-
print("Hello world")
|
|
33
|
-
start = input()
|
|
34
|
-
end = input()
|
|
35
|
-
for i in range(int(start), int(end)):
|
|
36
|
-
print(i)
|
|
37
|
-
""",
|
|
38
|
-
input="1\n10",
|
|
39
|
-
compiler=Runner.python39,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
You need to provide two parameters here.
|
|
44
|
-
api_key - you will get it from runcode.io dashboard after loging.
|
|
45
|
-
callback_url - Your application URL to process execution result.
|
|
46
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
47
|
-
## Django Example
|
|
48
|
-
```
|
|
49
|
-
from runcode import Runner
|
|
50
|
-
|
|
51
|
-
runner = Runner()
|
|
52
|
-
|
|
53
|
-
runner.execute(
|
|
54
|
-
code="""
|
|
55
|
-
print("Hello world")
|
|
56
|
-
start = input()
|
|
57
|
-
end = input()
|
|
58
|
-
for i in range(int(start), int(end)):
|
|
59
|
-
print(i)
|
|
60
|
-
""",
|
|
61
|
-
input="1\n10",
|
|
62
|
-
compiler=Runner.python39,
|
|
63
|
-
)
|
|
64
|
-
```
|
|
65
|
-
You need to specify compiler here.
|
|
66
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
67
|
-
|
|
68
|
-
You need to add two parameters to settings.py file.
|
|
69
|
-
|
|
70
|
-
RUNCODE_API_KEY - you will get it from runcode.io dashboard after loging.
|
|
71
|
-
RUNCODE_CALLBACK_URL - Your application URL to process execution result.
|
|
72
|
-
|
|
73
|
-
### Available compilers
|
|
74
|
-
```
|
|
75
|
-
python39 = "python-3.9.7"
|
|
76
|
-
gcc49 = "gcc-4.9"
|
|
77
|
-
cpp49 = "g++-4.9"
|
|
78
|
-
openjdk11 = "openjdk-11"
|
|
79
|
-
dotnet5 = "dotnet-5"
|
|
80
|
-
python27 = "python-2.7.18"
|
|
81
|
-
php81 = "php-8.1"
|
|
82
|
-
fsharp5 = "fsharp-5"
|
|
83
|
-
ruby30 = "ruby-3.0.2"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
For further support, contact hello@runcode.io
|
|
88
|
-
|
|
89
|
-
Platform: UNKNOWN
|
|
90
|
-
Classifier: Intended Audience :: Developers
|
|
91
|
-
Classifier: Operating System :: OS Independent
|
|
92
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
93
|
-
Classifier: Programming Language :: Python
|
|
94
|
-
Classifier: Programming Language :: Python :: 3
|
|
95
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
96
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
97
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
98
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
99
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
100
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
101
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
102
|
-
Description-Content-Type: text/markdown
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
README.md
|
|
2
|
-
setup.py
|
|
3
|
-
runcode/__init__.py
|
|
4
|
-
runcode/runner.py
|
|
5
|
-
runcode.egg-info/PKG-INFO
|
|
6
|
-
runcode.egg-info/SOURCES.txt
|
|
7
|
-
runcode.egg-info/dependency_links.txt
|
|
8
|
-
runcode.egg-info/requires.txt
|
|
9
|
-
runcode.egg-info/top_level.txt
|
|
10
|
-
runcode_sample/__init__.py
|
|
11
|
-
runcode_sample/asgi.py
|
|
12
|
-
runcode_sample/settings.py
|
|
13
|
-
runcode_sample/urls.py
|
|
14
|
-
runcode_sample/views.py
|
|
15
|
-
runcode_sample/wsgi.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
requests
|
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
ASGI config for runcode project.
|
|
3
|
-
|
|
4
|
-
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
5
|
-
|
|
6
|
-
For more information on this file, see
|
|
7
|
-
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import os
|
|
11
|
-
|
|
12
|
-
from django.core.asgi import get_asgi_application
|
|
13
|
-
|
|
14
|
-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'runcode.settings')
|
|
15
|
-
|
|
16
|
-
application = get_asgi_application()
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from dotenv import load_dotenv
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
load_dotenv()
|
|
6
|
-
|
|
7
|
-
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
8
|
-
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# Quick-start development settings - unsuitable for production
|
|
12
|
-
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
|
13
|
-
|
|
14
|
-
# SECURITY WARNING: keep the secret key used in production secret!
|
|
15
|
-
SECRET_KEY = "django-insecure-k7#@^xuh868*a_md7yll@9(h+((za&gs8t!ybln6*qxb!2s$fo"
|
|
16
|
-
|
|
17
|
-
# SECURITY WARNING: don't run with debug turned on in production!
|
|
18
|
-
DEBUG = True
|
|
19
|
-
|
|
20
|
-
ALLOWED_HOSTS = ["*"]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# Application definition
|
|
24
|
-
|
|
25
|
-
INSTALLED_APPS = [
|
|
26
|
-
"django.contrib.admin",
|
|
27
|
-
"django.contrib.auth",
|
|
28
|
-
"django.contrib.contenttypes",
|
|
29
|
-
"django.contrib.sessions",
|
|
30
|
-
"django.contrib.messages",
|
|
31
|
-
"django.contrib.staticfiles",
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
MIDDLEWARE = [
|
|
35
|
-
"django.middleware.security.SecurityMiddleware",
|
|
36
|
-
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
37
|
-
"django.middleware.common.CommonMiddleware",
|
|
38
|
-
"django.middleware.csrf.CsrfViewMiddleware",
|
|
39
|
-
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
40
|
-
"django.contrib.messages.middleware.MessageMiddleware",
|
|
41
|
-
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
ROOT_URLCONF = "runcode_sample.urls"
|
|
45
|
-
|
|
46
|
-
TEMPLATES = [
|
|
47
|
-
{
|
|
48
|
-
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
49
|
-
"DIRS": [],
|
|
50
|
-
"APP_DIRS": True,
|
|
51
|
-
"OPTIONS": {
|
|
52
|
-
"context_processors": [
|
|
53
|
-
"django.template.context_processors.debug",
|
|
54
|
-
"django.template.context_processors.request",
|
|
55
|
-
"django.contrib.auth.context_processors.auth",
|
|
56
|
-
"django.contrib.messages.context_processors.messages",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
WSGI_APPLICATION = "runcode_sample.wsgi.application"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# Database
|
|
66
|
-
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
|
67
|
-
|
|
68
|
-
DATABASES = {
|
|
69
|
-
"default": {
|
|
70
|
-
"ENGINE": "django.db.backends.sqlite3",
|
|
71
|
-
"NAME": BASE_DIR / "db.sqlite3",
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# Password validation
|
|
77
|
-
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
|
78
|
-
|
|
79
|
-
AUTH_PASSWORD_VALIDATORS = [
|
|
80
|
-
{
|
|
81
|
-
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
91
|
-
},
|
|
92
|
-
]
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# Internationalization
|
|
96
|
-
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
|
97
|
-
|
|
98
|
-
LANGUAGE_CODE = "en-us"
|
|
99
|
-
|
|
100
|
-
TIME_ZONE = "UTC"
|
|
101
|
-
|
|
102
|
-
USE_I18N = True
|
|
103
|
-
|
|
104
|
-
USE_L10N = True
|
|
105
|
-
|
|
106
|
-
USE_TZ = True
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
# Static files (CSS, JavaScript, Images)
|
|
110
|
-
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
|
111
|
-
|
|
112
|
-
STATIC_URL = "/static/"
|
|
113
|
-
|
|
114
|
-
# Default primary key field type
|
|
115
|
-
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
|
116
|
-
|
|
117
|
-
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
118
|
-
|
|
119
|
-
RUNCODE_API_KEY = os.getenv("RUNCODE_API_KEY")
|
|
120
|
-
RUNCODE_CALLBACK_URL = os.getenv("RUNCODE_CALLBACK_URL")
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from django.http.response import HttpResponse
|
|
3
|
-
from django.views.decorators.csrf import csrf_exempt
|
|
4
|
-
from runcode import Runner
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def run_code(request):
|
|
8
|
-
# runner = Runner(
|
|
9
|
-
# api_key="KMXQosOYD1Bmrg1OJg4PzaQyprVVXaYkCsv3HgTh",
|
|
10
|
-
# callback_url="http://7a91-2405-201-c00a-e012-4abc-50aa-3eb3-71d5.ngrok.io",
|
|
11
|
-
# )
|
|
12
|
-
runner = Runner()
|
|
13
|
-
runner.execute(
|
|
14
|
-
code="""
|
|
15
|
-
print("Hello world")
|
|
16
|
-
start = input()
|
|
17
|
-
end = input()
|
|
18
|
-
for i in range(int(start), int(end)):
|
|
19
|
-
print(i)
|
|
20
|
-
""",
|
|
21
|
-
input="1\n10",
|
|
22
|
-
compiler=Runner.python39,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
return HttpResponse("hi")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@csrf_exempt
|
|
29
|
-
def test_index(request):
|
|
30
|
-
received_json_data = json.loads(request.body)
|
|
31
|
-
print(received_json_data)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
WSGI config for runcode project.
|
|
3
|
-
|
|
4
|
-
It exposes the WSGI callable as a module-level variable named ``application``.
|
|
5
|
-
|
|
6
|
-
For more information on this file, see
|
|
7
|
-
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import os
|
|
11
|
-
|
|
12
|
-
from django.core.wsgi import get_wsgi_application
|
|
13
|
-
|
|
14
|
-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'runcode.settings')
|
|
15
|
-
|
|
16
|
-
application = get_wsgi_application()
|
runcode-0.1/setup.cfg
DELETED
runcode-0.1/setup.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import io
|
|
2
|
-
import os
|
|
3
|
-
from setuptools import setup, find_packages
|
|
4
|
-
|
|
5
|
-
VERSION = '0.1'
|
|
6
|
-
|
|
7
|
-
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
|
|
8
|
-
README = readme.read()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
setup(
|
|
12
|
-
name='runcode',
|
|
13
|
-
version=VERSION,
|
|
14
|
-
author='Micro Pyramid Informatic Pvt. Ltd.',
|
|
15
|
-
author_email='hello@micropyramid.com',
|
|
16
|
-
url='https://github.com/runcode-io/runcode-python',
|
|
17
|
-
description='RunCode Python API',
|
|
18
|
-
long_description=README,
|
|
19
|
-
long_description_content_type='text/markdown',
|
|
20
|
-
packages=find_packages(exclude=['tests', 'tests.*']),
|
|
21
|
-
include_package_data=True,
|
|
22
|
-
install_requires=[
|
|
23
|
-
'requests'
|
|
24
|
-
],
|
|
25
|
-
classifiers=[
|
|
26
|
-
'Intended Audience :: Developers',
|
|
27
|
-
'Operating System :: OS Independent',
|
|
28
|
-
'License :: OSI Approved :: MIT License',
|
|
29
|
-
'Programming Language :: Python',
|
|
30
|
-
'Programming Language :: Python :: 3',
|
|
31
|
-
'Programming Language :: Python :: 3.3',
|
|
32
|
-
'Programming Language :: Python :: 3.4',
|
|
33
|
-
'Programming Language :: Python :: 3.5',
|
|
34
|
-
'Programming Language :: Python :: 3.6',
|
|
35
|
-
'Programming Language :: Python :: 3.7',
|
|
36
|
-
'Programming Language :: Python :: 3.8',
|
|
37
|
-
'Topic :: Software Development :: Internationalization',
|
|
38
|
-
],
|
|
39
|
-
)
|