Giter VIP home page Giter VIP logo

codeclassroom / coderunner Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 5.0 373 KB

A judge ๐Ÿ‘จ๐Ÿฝโ€โš–๏ธ for your programs, run and test your programs using python

Home Page: https://codeclassroom.github.io/CodeRunner/

License: MIT License

Python 85.88% Java 4.75% C++ 3.84% C 2.19% Shell 3.35%
online-judge online-compiler judge0-api codeclassroom coderunner code-runner judge0 online-ide api-wrappers

coderunner's Introduction

CodeRunner ๐Ÿƒ

A judge ๐Ÿ‘จ๐Ÿฝโ€โš–๏ธ for your programs, run and test your programs using Python

PyPI Build Status codecov PyPI - Format PyPI - Python Version Documentation Status PyPI - Downloads

Installation

Install using pip from PyPI

pip install coderunner

or directly from GitHub if you cannot wait to test new features

pip install git+https://github.com/codeclassroom/CodeRunner.git

Usage

from coderunner import coderunner
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)

# run the code
r.run()

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

# See Documentation for more methods.

Documentation

CodeRunner Documentation

Development

Prerequisites
  • Python 3.6+
  • virtualenv
  1. Create virtual environment.
virtualenv -p python3 venv && cd venv && source bin/activate
  1. Clone the repository.
git https://github.com/codeclassroom/CodeRunner.git
  1. Install Dependencies.
pip install -r requirements.txt
  1. Run tests.
python tests.py
  1. Lint the project with
flake8 coderunner --max-line-length=88 --ignore=F401
black --check --diff coderunner

๐Ÿ“ Changelog

See the CHANGELOG.md file for details.

๐Ÿ”ฅ Powered By

Judge0 API - Free, robust and scalable open-source online code execution system

Author

๐Ÿ‘ฅ Bhupesh Varshney

forthebadge

๐Ÿ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ‘‹ Contributing

Please read the CONTRIBUTING guidelines for the process of submitting pull requests to us.

coderunner's People

Contributors

bhupesh-v avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

coderunner's Issues

Forbidden 403 error

I have attached the console log...

Steps to reproduce the behavior:
Submit any code

Desktop (please complete the following information):

  • OS: [Win]
  • Python Version [3.6]
  • CodeRunner version [ 0.7]

CodeRunner was working till 27-05-2020
Traceback (most recent call last): File "c:/Users/manoh/Desktop/Random Stuff/Scratch/scratch.py", line 19, in <module> r.run() File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\site-packages\coderunner\coderunner.py", line 227, in run token = self.__submit() File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\site-packages\coderunner\coderunner.py", line 165, in __submit with urllib.request.urlopen(req) as response: File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 569, in error return self._call_chain(*args) File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain result = func(*args) File "C:\Users\manoh\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

getStatus() returns FileNotFoundError

Describe the bug
If you run getStatus() more than one time then a FileNot Found Error Occurs.

Status : Wrong Answer
Traceback (most recent call last):
  File "demo.py", line 12, in <module>
    if r.getStatus() == "Wrong Answer":
  File "/home/bhupesh/Desktop/CodeRunner/coderunner/coderunner.py", line 159, in getStatus
    self.inp = self.__readStandardInput()
  File "/home/bhupesh/Desktop/CodeRunner/coderunner/coderunner.py", line 81, in __readStandardInput
    with open(self.inp, "r") as out:
FileNotFoundError: [Errno 2] No such file or directory: 'World'

To Reproduce
Steps to reproduce the behavior:

  1. create an object instance & call getStatus 2 times
r = coderunner.Run(program_name, language, output, Input, path=True)

print("Status : " + r.getStatus())
if r.getStatus() == "Wrong Answer":
	print("Wrong Boi")

Expected behavior
getStatus should return the status every time we call it.

Additional context
The reason it is happening is because getStatus() is actually submitting data twice to the judge server.

urllib.error.HTTPError: HTTP Error 401: Unauthorized

in windows 10 , i tried this coderunner but i gives 401 error

`

result = coderunner.code("print('hello')","Python3",path=False)
result.run()
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\SOUNDA1\Desktop\PYTHON1\ENV1\lib\site-packages\coderunner\coderunner.py", line 227, in run
token = self.__submit()
File "C:\Users\SOUNDA
1\Desktop\PYTHON1\ENV1\lib\site-packages\coderunner\coderunner.py", line 165, in __submit
with urllib.request.urlopen(req) as response:
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "c:\users\soundara rajan\appdata\local\programs\python\python37\Lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.