runcode 0.2__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.2 → runcode-0.3.0}/LICENSE +1 -1
- 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.2/PKG-INFO +0 -106
- runcode-0.2/README.md +0 -79
- runcode-0.2/runcode/__init__.py +0 -1
- runcode-0.2/runcode/runner.py +0 -74
- runcode-0.2/runcode.egg-info/PKG-INFO +0 -106
- runcode-0.2/runcode.egg-info/SOURCES.txt +0 -16
- runcode-0.2/runcode.egg-info/dependency_links.txt +0 -1
- runcode-0.2/runcode.egg-info/requires.txt +0 -1
- runcode-0.2/runcode.egg-info/top_level.txt +0 -2
- runcode-0.2/runcode_sample/__init__.py +0 -0
- runcode-0.2/runcode_sample/asgi.py +0 -16
- runcode-0.2/runcode_sample/settings.py +0 -120
- runcode-0.2/runcode_sample/urls.py +0 -9
- runcode-0.2/runcode_sample/views.py +0 -33
- runcode-0.2/runcode_sample/wsgi.py +0 -16
- runcode-0.2/setup.cfg +0 -4
- runcode-0.2/setup.py +0 -38
runcode-0.3.0/.gitignore
ADDED
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.2/PKG-INFO
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: runcode
|
|
3
|
-
Version: 0.2
|
|
4
|
-
Summary: RunCode Python API
|
|
5
|
-
Home-page: https://github.com/runcode-io/runcode-python
|
|
6
|
-
Author: RunCode
|
|
7
|
-
Author-email: hello@runcode.io
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE
|
|
25
|
-
|
|
26
|
-
# RunCode Python API
|
|
27
|
-
|
|
28
|
-
This API is as simaple as send your code and getting execution result.
|
|
29
|
-
|
|
30
|
-
Install
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
pip install runcode
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Python Example
|
|
39
|
-
```
|
|
40
|
-
from runcode import Runner
|
|
41
|
-
|
|
42
|
-
runner = Runner(
|
|
43
|
-
api_key="",
|
|
44
|
-
callback_url="",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
runner.execute(
|
|
48
|
-
code="""
|
|
49
|
-
print("Hello world")
|
|
50
|
-
start = input()
|
|
51
|
-
end = input()
|
|
52
|
-
for i in range(int(start), int(end)):
|
|
53
|
-
print(i)
|
|
54
|
-
""",
|
|
55
|
-
input="1\n10",
|
|
56
|
-
compiler=Runner.python39,
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
You need to provide two parameters here.
|
|
61
|
-
api_key - you will get it from runcode.io dashboard after loging.
|
|
62
|
-
callback_url - Your application URL to process execution result.
|
|
63
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
64
|
-
## Django Example
|
|
65
|
-
```
|
|
66
|
-
from runcode import Runner
|
|
67
|
-
|
|
68
|
-
runner = Runner()
|
|
69
|
-
|
|
70
|
-
runner.execute(
|
|
71
|
-
code="""
|
|
72
|
-
print("Hello world")
|
|
73
|
-
start = input()
|
|
74
|
-
end = input()
|
|
75
|
-
for i in range(int(start), int(end)):
|
|
76
|
-
print(i)
|
|
77
|
-
""",
|
|
78
|
-
input="1\n10",
|
|
79
|
-
compiler=Runner.python39,
|
|
80
|
-
)
|
|
81
|
-
```
|
|
82
|
-
You need to specify compiler here.
|
|
83
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
84
|
-
|
|
85
|
-
You need to add two parameters to settings.py file.
|
|
86
|
-
|
|
87
|
-
RUNCODE_API_KEY - you will get it from runcode.io dashboard after loging.
|
|
88
|
-
RUNCODE_CALLBACK_URL - Your application URL to process execution result.
|
|
89
|
-
|
|
90
|
-
### Available compilers
|
|
91
|
-
```
|
|
92
|
-
python39 = "python-3.9.7"
|
|
93
|
-
gcc49 = "gcc-4.9"
|
|
94
|
-
cpp49 = "g++-4.9"
|
|
95
|
-
openjdk11 = "openjdk-11"
|
|
96
|
-
dotnet5 = "dotnet-5"
|
|
97
|
-
python27 = "python-2.7.18"
|
|
98
|
-
php81 = "php-8.1"
|
|
99
|
-
fsharp5 = "fsharp-5"
|
|
100
|
-
ruby30 = "ruby-3.0.2"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
For further support, contact hello@runcode.io
|
|
105
|
-
|
|
106
|
-
|
runcode-0.2/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.2/runcode/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .runner import Runner
|
runcode-0.2/runcode/runner.py
DELETED
|
@@ -1,74 +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, extra_params={}):
|
|
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
|
-
:extra_params: json dict to post extra parameters to identify the response or any other purpose
|
|
50
|
-
Usage::
|
|
51
|
-
>>> runner.execute(
|
|
52
|
-
code='''
|
|
53
|
-
print("Hello world")
|
|
54
|
-
start = input()
|
|
55
|
-
end = input()
|
|
56
|
-
for i in range(int(start), int(end)):
|
|
57
|
-
print(i)
|
|
58
|
-
''',
|
|
59
|
-
input="1\n10",
|
|
60
|
-
compiler=Runner.python39,
|
|
61
|
-
)
|
|
62
|
-
"""
|
|
63
|
-
|
|
64
|
-
out = {
|
|
65
|
-
"api_key": self.api_key,
|
|
66
|
-
"code": code,
|
|
67
|
-
"input": input,
|
|
68
|
-
"compiler": compiler,
|
|
69
|
-
"callback_url": self.callback_url,
|
|
70
|
-
"extra_params": extra_params,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
r = requests.post("https://app.runcode.io/api/run-code/", json=out)
|
|
74
|
-
# r = requests.post("http://localhost:8000/api/run-code/", json=out)
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: runcode
|
|
3
|
-
Version: 0.2
|
|
4
|
-
Summary: RunCode Python API
|
|
5
|
-
Home-page: https://github.com/runcode-io/runcode-python
|
|
6
|
-
Author: RunCode
|
|
7
|
-
Author-email: hello@runcode.io
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE
|
|
25
|
-
|
|
26
|
-
# RunCode Python API
|
|
27
|
-
|
|
28
|
-
This API is as simaple as send your code and getting execution result.
|
|
29
|
-
|
|
30
|
-
Install
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
pip install runcode
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Python Example
|
|
39
|
-
```
|
|
40
|
-
from runcode import Runner
|
|
41
|
-
|
|
42
|
-
runner = Runner(
|
|
43
|
-
api_key="",
|
|
44
|
-
callback_url="",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
runner.execute(
|
|
48
|
-
code="""
|
|
49
|
-
print("Hello world")
|
|
50
|
-
start = input()
|
|
51
|
-
end = input()
|
|
52
|
-
for i in range(int(start), int(end)):
|
|
53
|
-
print(i)
|
|
54
|
-
""",
|
|
55
|
-
input="1\n10",
|
|
56
|
-
compiler=Runner.python39,
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
You need to provide two parameters here.
|
|
61
|
-
api_key - you will get it from runcode.io dashboard after loging.
|
|
62
|
-
callback_url - Your application URL to process execution result.
|
|
63
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
64
|
-
## Django Example
|
|
65
|
-
```
|
|
66
|
-
from runcode import Runner
|
|
67
|
-
|
|
68
|
-
runner = Runner()
|
|
69
|
-
|
|
70
|
-
runner.execute(
|
|
71
|
-
code="""
|
|
72
|
-
print("Hello world")
|
|
73
|
-
start = input()
|
|
74
|
-
end = input()
|
|
75
|
-
for i in range(int(start), int(end)):
|
|
76
|
-
print(i)
|
|
77
|
-
""",
|
|
78
|
-
input="1\n10",
|
|
79
|
-
compiler=Runner.python39,
|
|
80
|
-
)
|
|
81
|
-
```
|
|
82
|
-
You need to specify compiler here.
|
|
83
|
-
compiler - You can choose any of the available compilers from RunCode docs.
|
|
84
|
-
|
|
85
|
-
You need to add two parameters to settings.py file.
|
|
86
|
-
|
|
87
|
-
RUNCODE_API_KEY - you will get it from runcode.io dashboard after loging.
|
|
88
|
-
RUNCODE_CALLBACK_URL - Your application URL to process execution result.
|
|
89
|
-
|
|
90
|
-
### Available compilers
|
|
91
|
-
```
|
|
92
|
-
python39 = "python-3.9.7"
|
|
93
|
-
gcc49 = "gcc-4.9"
|
|
94
|
-
cpp49 = "g++-4.9"
|
|
95
|
-
openjdk11 = "openjdk-11"
|
|
96
|
-
dotnet5 = "dotnet-5"
|
|
97
|
-
python27 = "python-2.7.18"
|
|
98
|
-
php81 = "php-8.1"
|
|
99
|
-
fsharp5 = "fsharp-5"
|
|
100
|
-
ruby30 = "ruby-3.0.2"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
For further support, contact hello@runcode.io
|
|
105
|
-
|
|
106
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
setup.py
|
|
4
|
-
runcode/__init__.py
|
|
5
|
-
runcode/runner.py
|
|
6
|
-
runcode.egg-info/PKG-INFO
|
|
7
|
-
runcode.egg-info/SOURCES.txt
|
|
8
|
-
runcode.egg-info/dependency_links.txt
|
|
9
|
-
runcode.egg-info/requires.txt
|
|
10
|
-
runcode.egg-info/top_level.txt
|
|
11
|
-
runcode_sample/__init__.py
|
|
12
|
-
runcode_sample/asgi.py
|
|
13
|
-
runcode_sample/settings.py
|
|
14
|
-
runcode_sample/urls.py
|
|
15
|
-
runcode_sample/views.py
|
|
16
|
-
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,33 +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
|
-
extra_params={"ukey": "16"},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
return HttpResponse("hi")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@csrf_exempt
|
|
30
|
-
def test_index(request):
|
|
31
|
-
received_json_data = json.loads(request.body)
|
|
32
|
-
print(received_json_data)
|
|
33
|
-
return HttpResponse("ok")
|
|
@@ -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.2/setup.cfg
DELETED
runcode-0.2/setup.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import io
|
|
2
|
-
import os
|
|
3
|
-
from setuptools import setup, find_packages
|
|
4
|
-
|
|
5
|
-
VERSION = "0.2"
|
|
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="RunCode",
|
|
15
|
-
author_email="hello@runcode.io",
|
|
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=["requests"],
|
|
23
|
-
classifiers=[
|
|
24
|
-
"Intended Audience :: Developers",
|
|
25
|
-
"Operating System :: OS Independent",
|
|
26
|
-
"License :: OSI Approved :: MIT License",
|
|
27
|
-
"Programming Language :: Python",
|
|
28
|
-
"Programming Language :: Python :: 3",
|
|
29
|
-
"Programming Language :: Python :: 3.3",
|
|
30
|
-
"Programming Language :: Python :: 3.4",
|
|
31
|
-
"Programming Language :: Python :: 3.5",
|
|
32
|
-
"Programming Language :: Python :: 3.6",
|
|
33
|
-
"Programming Language :: Python :: 3.7",
|
|
34
|
-
"Programming Language :: Python :: 3.8",
|
|
35
|
-
"Programming Language :: Python :: 3.9",
|
|
36
|
-
"Topic :: Software Development :: Internationalization",
|
|
37
|
-
],
|
|
38
|
-
)
|