Skip to content

Commit

Permalink
ready for merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhupesh-V committed Jul 23, 2020
1 parent 862e9eb commit f84965b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 51 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file.
- Custom API URL support

### Changed
- Due to Judge0 API going [freemium](https://github.com/judge0/api/issues/171), the default API URL, [https://api.judge0.com] is no longer available. To use the API signup for a plan on [RapidAPI](https://rapidapi.com/hermanzdosilovic/api/judge0/pricing)
- Due to Judge0 API going [freemium](https://github.com/judge0/api/issues/171), the default API URL, [https://api.judge0.com] is no longer available. To use the API signup for a plan on [RapidAPI](https://rapidapi.com/hermanzdosilovic/api/judge0/pricing) & use the token to access the API through coderunner.


## [0.8] - May 27, 2020
Expand Down
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,32 @@ pip install git+https://github.com/codeclassroom/CodeRunner.git

```python

import coderunner
from coderunner import coderunner
import os

source_code = "path-to/test_python.py"
language = "Python"
expected_output = "path-to/output.txt"
standard_input = "path-to/input.txt"
from dotenv import load_dotenv
load_dotenv()

# use this if you have a standard input to Program
r = coderunner.code(source_code, language, expected_output, standard_input)
source_code = "testfiles/" + "test_python_input.py"
language = "Python3"
output = "testfiles/output/" + "output2.txt"
Input = "testfiles/input/" + "input.txt"

# otherwise
r = coderunner.code(source_code, language, expected_output)

# you can also ignore both fields
r = coderunner.code(source_code, language)
API_KEY = os.environ["API_KEY"]

# Use path=False if not using file paths
r = coderunner.code("Hello, World", language, "Hello, World", path=False)
r = coderunner.code(source_code, language, output, Input)

# Necessary step to initialize API keys & URL
r.api(key=API_KEY)

# run the code
r.run()
print(r.getOutput())
print(r.getError())

print("Running r :")
print("Status : " + r.getStatus())
print("Output : " + r.getOutput())

# See Documentation for more methods.
```

Expand Down
23 changes: 2 additions & 21 deletions demo.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
from coderunner import coderunner
import pprint
import os

from dotenv import load_dotenv

load_dotenv()

source_code = "testfiles/" + "test_python_input.py"
language = "Python3"
output = "testfiles/output/" + "output2.txt"
Input = "testfiles/input/" + "input.txt"


API_KEY = os.environ["API_KEY"]

r = coderunner.code(source_code, language, output, Input)

# Necessary step to initialize API keys & URL
r.api(key=API_KEY)

# r2 = coderunner.code("print(\"yo\")", "Python3", "YO", path=False)

# # run the code
# run the code
r.run()

print("Run r :")
print("Running r :")
print("Status : " + r.getStatus())
print("Output : " + r.getOutput())

# r2.run()

# print("Run r2 :")
# print("Status : " + r2.getStatus())

# # check if any error occured
# if r.getError() is not None:
# pprint.pprint("Error : " + r.getError())
# else:
# print("Standard Output : ")
# pprint.pprint(r.getOutput())
# print("Execution Time : " + r.getTime())
# print("Memory : " + str(r.getMemory()))
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file.
- Custom API URL support

### Changed
- Due to Judge0 API going [freemium](https://github.com/judge0/api/issues/171), the default API URL, [https://api.judge0.com] is no longer available. To use the API signup for a plan on [RapidAPI](https://rapidapi.com/hermanzdosilovic/api/judge0/pricing)
- Due to Judge0 API going [freemium](https://github.com/judge0/api/issues/171), the default API URL, [https://api.judge0.com] is no longer available. To use the API signup for a plan on [RapidAPI](https://rapidapi.com/hermanzdosilovic/api/judge0/pricing) & use the token to access the API through coderunner.


## [0.8] - May 27, 2020
Expand Down
32 changes: 21 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,31 @@ pip install git+https://github.com/codeclassroom/CodeRunner.git

```python

import coderunner
from coderunner import coderunner
import os

source_code = "path-to/test_python.py"
language = "Python"
expected_output = "path-to/output.txt"
standard_input = "path-to/input.txt"
from dotenv import load_dotenv
load_dotenv()

# use this if you have a standard input to Program
r = coderunner.code(source_code, language, expected_output, standard_input)
source_code = "testfiles/" + "test_python_input.py"
language = "Python3"
output = "testfiles/output/" + "output2.txt"
Input = "testfiles/input/" + "input.txt"

# otherwise
r = coderunner.code(source_code, language, expected_output)

# Use path=False if not using file paths
r = coderunner.code("Hello, World", language, "Hello, World", path=False)
API_KEY = os.environ["API_KEY"]

r = coderunner.code(source_code, language, output, Input)

# Necessary step to initialize API keys & URL
r.api(key=API_KEY)

# run the code
r.run()

print("Running r :")
print("Status : " + r.getStatus())
print("Output : " + r.getOutput())
```

## Documentation
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
license="MIT",
author="Bhupesh Varshney",
author_email="varshneybhupesh@gmail.com",
description="A judge for your programs, run and test your programs using Python",
keywords="judge0 coderunner judge0api codeclassroom ",
description="A judge for your programs, run and test your programs using python",
keywords="judge0 coderunner judge0api codeclassroom",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://codeclassroom.github.io/CodeRunner/",
Expand Down

0 comments on commit f84965b

Please sign in to comment.