Skip to content

Commit c3986da

Browse files
Nathan SpragueNathan Sprague
authored andcommitted
update README and add scaffolding folder to autogenerated template.
1 parent 24855c3 commit c3986da

3 files changed

Lines changed: 116 additions & 18 deletions

File tree

README.md

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,129 @@ Features include:
1919
* A script that makes it possible to test the autograder logic
2020
locally before uploading to the Gradescope server:
2121
`test_autograder.py`
22+
* A graphical tool for testing autograders and building autograder zip
23+
files.
2224

23-
Documentation can be found here: <https://jmu-cs.github.io/jmu_python_gradescope_utils/>
25+
API Documentation can be found here: <https://jmu-cs.github.io/jmu_python_gradescope_utils/>
2426

2527
## Installation
2628

2729
```
30+
pip3 install wheel
2831
pip3 install git+https://github.com/JMU-CS/jmu_python_gradescope_utils.git
2932
```
3033

31-
## Instructions
34+
On Linux, this will probably add the GUI script to your PATH so that it can be executed as:
3235

33-
See `examples/hello_world_autograder/` for a sample autograder.
36+
```
37+
$ jmu_gradescope_builder.py
38+
```
39+
40+
If that doesn't work, you may need to execute the script using the Python interpreter:
41+
42+
```
43+
python3 jmu_python_gradescope_utils/scripts/jmu_gradescope_builder.py
44+
```
45+
46+
## Autograder Format
47+
48+
See `examples/hello_world/` and `hello_world_w_coverage` for a sample autograders.
49+
50+
Autograder folders are organized as follows:
51+
52+
```
53+
hello_world/
54+
55+
├── config.ini
56+
57+
├── configurations/
58+
│ ├── flake8.cfg
59+
│ ├── docstring.cfg
60+
│ └── requirements.txt
61+
62+
├── sample/
63+
│ └── hello_world.py
64+
65+
└── scaffolding/
66+
67+
└── tests/
68+
└── test_hello.py
69+
```
70+
71+
72+
### `config.ini`
73+
74+
This specifies the files that must be submitted by the student:
75+
76+
```
77+
[SUBMIT]
78+
code: hello_world.py
79+
tests:
80+
```
81+
82+
The `test` field should contain the names of student test files for assignments that require student-submitted unit tests.
3483

35-
To perform a test run:
84+
### `flake8.cfg`
3685

37-
```bash
38-
$ cd /your/autograder
39-
$ test_autograder.py /path/to/sample/submission/folder
86+
This is the `flake8` configuration file that will be used by
87+
[assertPassesPep8](https://jmu-cs.github.io/jmu_python_gradescope_utils/jmu_test_case.html#jmu_gradescope_utils.jmu_test_case._JmuTestCase.assertPassesPep8).
88+
89+
The [flake8](https://flake8.pycqa.org/en/latest/index.html) tool is
90+
used by our library for Python style checking. The possible error
91+
codes are listed in the following locations:
92+
93+
* [pycodestyle error codes](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes)
94+
* [flake8 error codes](https://flake8.pycqa.org/en/latest/user/error-codes.html)
95+
96+
97+
The current default looks like this:
98+
```
99+
[flake8]
100+
select = E, F, C90
101+
ignore = W, E226, E123, W504, N818, E704, E24, E121, E126
102+
max-line-length = 100
40103
```
41104

42-
The output of the test will be stored in a file named
43-
`test_results.json`.
105+
### `docstring.cfg`
106+
This is the `flake8` configuration file that will be used by [assertDocstringsCorrect](https://jmu-cs.github.io/jmu_python_gradescope_utils/jmu_test_case.html#jmu_gradescope_utils.jmu_test_case._JmuTestCase.assertDocstringsCorrect). The current default looks like this:
44107

45-
Once everything is working correctly, just zip the contents of the
46-
autograder folder and upload to Gradescope:
108+
```
109+
[flake8]
110+
select = D,DAR
111+
ignore = D401
112+
113+
[pydocstyle]
114+
convention=google
47115
48-
```bash
49-
$ cd /your/autograder
50-
$ zip -r autograder.zip .
116+
[darglint]
117+
docstring_style=google
51118
```
119+
120+
The available error codes for the two plugins can be found here:
121+
122+
* `pydocstyle`: <http://www.pydocstyle.org/en/stable/error_codes.html>
123+
* `darglint`: <https://github.com/terrencepreilly/darglint#error-codes>
124+
125+
126+
### `requirements.txt`
127+
128+
This file should list any python packages that are required for this
129+
assignment. They will be pip installed on the server by the autograder
130+
script.
131+
132+
### sample/
133+
134+
This folder should contain a reference solution. This isn't strictly
135+
necessary, but the autograder testing utility will expect to find a
136+
solution at this location.
137+
138+
### scaffolding/
139+
140+
Any files in this folder will be copied into the same folder as the
141+
student submission before testing. This could be data files or Python
142+
modules.
143+
144+
### tests/
145+
146+
Instructor unit tests.
147+

jmu_gradescope_utils/build_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import subprocess
1111
import traceback
1212
import sys
13-
import shutil
1413

1514
def create_template(folder):
1615
path = Path(folder)
@@ -21,9 +20,11 @@ def create_template(folder):
2120
source = pkg_resources.resource_filename('jmu_gradescope_utils',
2221
os.path.join('data', 'template'))
2322
shutil.copytree(source, path)
23+
# Can't have empty folders in the template...
24+
(path / 'scaffolding').mkdir(exist_ok=True)
2425
logging.info(f'Created {path}')
2526
return True
26-
27+
2728

2829
def test_autograder(autograder_folder, sample_folder,
2930
delete_tmp_folder=True):

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ def package_files(directory):
2222
author_email='nathan.r.sprague@gmail.com',
2323
description='Python Gradescope utilities',
2424
install_requires=[
25-
'gradescope-utils',
25+
'gradescope-utils>=0.4',
2626
'flake8',
27-
'coverage',
27+
'coverage>=6.0',
2828
'pep8-naming',
2929
'flake8-docstrings',
3030
'flake8-rst-docstrings',
3131
'darglint',
3232
'tk',
33+
'importlib_metadata>=4.2',
3334
],
3435
scripts=['scripts/test_autograder.py',
3536
'scripts/jmu_gradescope_builder.py'],

0 commit comments

Comments
 (0)