pyjaipur / pyjudge Goto Github PK
View Code? Open in Web Editor NEWSimple Programming Contest hosting software
License: MIT License
Simple Programming Contest hosting software
License: MIT License
I found this one missing from our README.md. and I think it is very important to have if anyone new would like to contribute. so it would be great if we can update readme for that.
Statistics based on the submissions done by user.
Features:
Right now our system provides the ability to host a single contest at a time. We need to include the ability to host multiple contests at the same time.
For example, one contest can be a simple practice contest so that people can see how the system works. Then the real contest can start based on the time setting implementation for #103
I think the missing return statement was missed during review. Someone please add it on this line
Our system needs a database system since if we restart the server right now, all attempt information is lost. The simplest system is to use the shelve system provided by python. This would store the data you update on the disk so that the server can be restarted and no information is lost.
You would need to store whatever gets lost whenever the server is restarted, for example the attempt history.
A participant must be able to download an input file related to the question. She will then run her program on this input file and produce an output file according to the question's instructions.
The web server must be able to supply this file when the participant asks for it by clicking on the link mentioned in #2
server.py
There is no concept of contest timings right now.
There are two problems with the system right now.
A simple/bare bones solution for this is to have something called a session:
Asking for these pairs again and again becomes irritating very quickly. Instead what we do is:
The code present in these lines is not relevant to the software we are trying to build. It needs to be removed.
I am submitting this regarding a :
Description of the ISSUE :
Appropriate Label for this ISSUE would be :
If a bug report, then description of the expected and present behaviour :
Questions are added via the file system right now. We need a mechanism to be able to add them via the web interface.
roadmap for this:
Our project now has some logic code (like the ranking function). Since these functions/computations can be written over multiple lines, code formatting becomes an issue. Different people have different styles of writing the same code.
To make collaboration easier, we don't leave it up to the programmer to select a style. We enforce a style using Black.
To solve this issue, go through the README of the Black project and set it up with the git pre commit hook method as mentioned in this part of the README
In the file upload code, the uploaded file is written to filesystem. We can avoid that by simply accessing the string directly using request.files.get('upload').file.read()
and comparing that to the expected output.
The expected file is read every time the URL is called. We can read the file once and store the expected string globally and simply use that in the API. Thus the api will have no File read write inside it. Only string comparison.
app = Bottle()
code. Store the expected string in a variable.The system needs a home page which describes the judge system and provides answers to common questions.
You'll need to add a new html file in the template system and change the /
function in the server.py
The Rankings.html
file is supposed to be in the templates
folder and the server has to use it from there.
related to #62
I am submitting this regarding a:
Description of the ISSUE:
it's not telling the output correctly. though following part of the code looks good when we see it.
expected = expected.strip()
uploaded = uploaded.strip()
ans = (uploaded==expected)
if not ans:
return "Wrong Answer!!"
else:
return "Solved! Great Job! "
expected and present behavior
someone need to look into it and see what's going on.
An HTML page needs to be written to show the ranking generated in #30
The following information is available
Continuous testing has to be added to the system. Many vendors are present:
Use some CI system and perform the following:
We need a sample question. The question statement must be included either in the HTML in #2 or in another file (maybe named statement.txt
) and combined with the template feature in the Bottle framework.
A nice question I like is "Given a file which has numbers on every line, generate a file which has the squares of those numbers on corresponding lines"
server.py
The expected output in the sample question has nothing in it. It needs to have correct outputs.
Dependency of pytest module is not present in the Pipfile in branch test. It has to be installed in pipenv if we are using it.
As users attempt questions, we need to record their attempts somehow. For now, we must store the attempts in a list. The information to store can be username, correct_or_not, question_number
The merge request for the question in #11 makes a folder and moves the question as a file in that folder. Let's keep the input file, output file, question statement in the same folder?
Right now, black and pre-commit are installed as normal dependencies for the project. We need to move them to the dev section of the dependencies. See pipenv docs for more info. If you need more help, ask here
The html in index.html
has some CSS classes which are note being used. We need to clean it up. that file also has lots of inline style code. That has to be removed.
**I am submitting this regarding **
Description of the ISSUE:
currently, the file is read everytime server is run.
I want the file to be read only when it's required and someone is uploading his file to be checked.
Sometimes it can be difficult to know what all to solve. Multiple issues can be related to each other and sometimes solving one thing can cause other issues and so on. Here are a few guiding principles. They can be broken, but only if a very good reason is there.
A good reason can be "This PR will fix 100 issues together with 1 line of code".
WIP:
in the title.There are other guidelines but they only come into picture once the project is large enough. For now this should be ok.
We need a place for the participant to upload her program's output. We should be able to accept a plain text file from the form mentioned in #2
On accepting the file, we have to compare it to a known output file and tell the user if the output was correct or not.
server.py
expected_output.txt
Instead of just one ranking system it would be nice to be able to rank competitors using multiple ranking systems as mentioned in #30
PRs for this issue must include:
The web server must show a HTML page which has the following:
server.py
While bottle provides a simple template system, almost everyone coming to this project has been already exposed to some other template system. This causes the misuse of bottle's own template system. Using import instead of rebase for example is a common mistake.
We can instead use the more common Jinja2 template system. Relevant documentation can be found in bottle's documentation
Make a template and handler for requests with invalid urls and return that template whenever FileNotFound is invoked.
As found out in another discussion the project is now big enough that simply reading the code during review does not ensure that it will run.
For starters a simple test file is needed which can run the server and make sure it does not crash. Later on we can add more tests.
Right now people can upload output and know if it was correct or not. We now need to record who uploaded the output. So, the following changes need to be made:
A new URL must be written along with corresponding HTML page to display the user's ranking. The ranking must be calculated on some scoring system (for example how many questions have you correctly attempted?).
this ranking must display the user's names and their rank.
The system must be able to show multiple questions. Thus the HTML must have a variable part which has the question in it. Refer to Bottle's documentation on the template system. We will be using that.
During attempts also, there must be a field which mentions which question the person is attempting so that the given output can be checked against the correct "expected.txt" file.
A link needs to be added to the README which points to the PyJudge telegram group
Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.
I am submitting this regarding a :
Description of the ISSUE :
Appropriate Label for this ISSUE would be :
If a bug report, then description of the expected and present behaviour :
The UI will need to account for the fact that multiple contests can be hosted at the same time.
Thus #104 will need to change to show multiple contests somehow.
The question and ranking HTML both define some common things (like HTML, HEAD, BODY).
We can move the common things into a base.html
file and use that in both question.html
and rankings.html
. See bottle template functions to understand how to do this.
Final folder structure can look like:
.
├── css
│ └── styles.css
├── files
│ └── questions
│ ├── 1
│ │ ├── inputs.txt
│ │ ├── output.txt
│ │ └── statement.txt
│ └── 2
│ ├── inputs.txt
│ ├── output.txt
│ └── statement.txt
├── README.md
├── server.py
└── templates
├── base.html
├── question.html
└── ranking.html
The question statement page requires css files. Those files are not served by the server at the moment. We need to provide the css files just like we are providing the inputs for the questions. Maybe we can move both static files like css and input files to a single folder and serve that folder location?
It would be nice to be able to pip install this project.
Since people are opening pull requests now, it's becoming irritating to manually close issues which the PR solves. A Pull request template will solve this.
Refer to github docs on PR templates and add a template. The template should ask the person to mention the issue that they are trying to solve. Then when the PR is merged, the issue is closed automatically.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.