Skip to content

Commit c8b7204

Browse files
authored
[misc] Update to RepoBee 3 (#17)
1 parent b1b13c9 commit c8b7204

File tree

7 files changed

+166
-194
lines changed

7 files changed

+166
-194
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
99

1010
A plugin for reporting grades into a CSV file based on issue titles.
11-
`repobee-csvgrades` adds the `record-grades` command, which operates on the
11+
`repobee-csvgrades` adds the `record` category to repobee, along with the `grades` command, which operates on the
1212
JSON file produced by running `repobee list-issues` with the
1313
`--hook-results-file` option. The idea is pretty simple: find issues in student
1414
repositories that match certain user-defined conditions (title + who opened it)
@@ -60,14 +60,14 @@ That's just a quick introduction, see [Usage](#usage) for a more detailed
6060
description.
6161

6262
## Install
63-
Currently, the best way to install is directly from the Git repo.
63+
As of `Repobee 3.0`, installing a plugin is easier than ever.
6464

65-
```
66-
$ python3 -m pip install git+https://github.com/slarse/repobee-csvgrades.git
67-
```
65+
First, make sure that you have the latest version of `Repobee` installed,
66+
instructions can be found on the [Repobee website](https://repobee.org/).
67+
68+
To install `repobee-csvgrades`, simply run the command `repobee plugin install`, and this will open up a bullet-list where you can select csvgrades.
6869

69-
Eventually, `repobee-csvgrades` will be moved to PyPi so you can just `pip
70-
install` it like any other package.
70+
> If `repobee-csvgrades` does not show up when running the `grades record` command. Run `repobee plugin list`, this will present a list with all the availiable plugins. If you cannot find `repobee-csvgrades` in the list, try updating `repobee` using repobee `repobee manage upgrade`.
7171
7272
## Usage
7373
`repobee-csvgrades` is easy to use and highly customizable. First of all, you
@@ -80,7 +80,7 @@ don't miss the fact that you can configure all options in the
8080

8181
### The grade specification (`--grade-specs` option)
8282
The grade specification (or _grade spec_) is the most important part of this
83-
plugin. Grade specs tell the `record-grades` command which issues to consider as
83+
plugin. Grade specs tell the `grades record` command which issues to consider as
8484
grading issues, and which grading issues outweigh others if several are found. A
8585
typical grade spec looks like this: `1:P:[Pp]ass`. There are three parts to the
8686
grade spec, delimited by `:`. First is the priority. A lower priority outweighs
@@ -98,14 +98,14 @@ Grade specs are specified by the `--grade-specs` option. Example:
9898
```
9999

100100
### The hook results file (`--hook-results-file` option)
101-
`record-grades` operates on a file with a JSON database produced by the
102-
`list-issues` command (one of RepoBee's core commands). The file is produced by
103-
supplying the `--hook-results-file FILEPATH` option to `list-issues`. You
104-
should additionally supply `list-issues` with the `--all` flag, to get both open
101+
`grades record` operates on a file with a JSON database produced by the
102+
`issues list` command (one of RepoBee's core commands). The file is produced by
103+
supplying the `--hook-results-file FILEPATH` option to `issues list`. You
104+
should additionally supply `issues list` with the `--all` flag, to get both open
105105
and closed issues (so as to avoid missing grading issues). If you try to use
106-
`record-grades` with a hook results file that's been produced without the
106+
`grades record` with a hook results file that's been produced without the
107107
`--all` flag, it will exit with an error. If you really want to run with that
108-
file, you can supply the `--allow-other-states` flag to `record-grades`, which
108+
file, you can supply the `--allow-other-states` flag to `grades record`, which
109109
disregards how the hook results were collected.
110110

111111
The hook results file is specified by the `--hook-results-file` option. Example:
@@ -115,7 +115,7 @@ The hook results file is specified by the `--hook-results-file` option. Example:
115115
```
116116

117117
### The grades file (`--grades-file` option)
118-
`record-grades` writes grades to a CSV file that we refer to as the _grades
118+
`grades record` writes grades to a CSV file that we refer to as the _grades
119119
file_. Each row represents one student, except for the first row which is a
120120
header row. The following requirements are placed on the CSV file format:
121121

@@ -127,7 +127,7 @@ header row. The following requirements are placed on the CSV file format:
127127
must exactly match the master repo's name
128128

129129
Below is an example grades file that has been partially filled in by the
130-
`record-grades` command. As it is a CSV file, it is rendered very nicely on
130+
`grades record` command. As it is a CSV file, it is rendered very nicely on
131131
GitHub (see for example [this test file](/tests/expected_grades.csv)), and it
132132
is strongly recommended that you keep this file in version control.
133133

@@ -141,15 +141,15 @@ is strongly recommended that you keep this file in version control.
141141
There are a few additional things to keep in mind with the grades file.
142142

143143
* You should not manually edit the file with grade symbols for which there are
144-
no grade specifications, as this may cause `record-grades` to exit because it
144+
no grade specifications, as this may cause `grades record` to exit because it
145145
can't find a priority for the grade.
146146
* You can't have a task called `username`.
147147
* You can't have duplicate column headers.
148-
* You **can** have any additional columns that you want. `record-grades` will
148+
* You **can** have any additional columns that you want. `grades record` will
149149
only look at the `username` column, and the columns corresponding to the
150150
master repo names that you specify when calling the command. Additional
151151
columns will simply not be inspected.
152-
* `record-grades` formats the diff file such that every cell of the same column
152+
* `grades record` formats the diff file such that every cell of the same column
153153
has the same width, which makes diffs easy to inspect.
154154
- Because of this formatting, it is recommended to keep grade spec symbols
155155
shorter than the master repo names, to avoid resizing of columns when grades
@@ -162,7 +162,7 @@ The grades file is specified by the `--grades-file` option. Example:
162162
```
163163

164164
### The edit message file (`--edit-msg-file` option)
165-
Each time you run `record-grades`, a file is produced specifying what new grades
165+
Each time you run `grades record`, a file is produced specifying what new grades
166166
were recorded, and tags the teachers who opened the grading issues. The
167167
intention is that this edit message should be used as a Git commit message. For
168168
example, if `slarse` has teacher `ta_a`, and `glassey` has teacher `ta_b`, and
@@ -192,7 +192,7 @@ option. Example:
192192
```
193193

194194
### Authorized teachers (`--teachers` option)
195-
The `record-grades` command requires you to specify a set of teachers that are
195+
The `grades record` command requires you to specify a set of teachers that are
196196
authorized to open grading issues. This is to avoid having students trick the
197197
system. If an grading issue by an unauthorized user is found, a warning is
198198
emitted. This is both to alert the user about potential attempts at foul play,

repobee_csvgrades/_file.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@
77
"""
88
import csv
99
import sys
10+
import pathlib
1011

1112
import repobee_plug as plug
1213

1314

1415
def read_results_file(results_file):
1516
if not results_file.is_file():
16-
raise plug.PlugError("no such file: {}".format(str(results_file)))
17+
raise plug.PlugError(f"no such file: {str(results_file)}")
1718
return plug.json_to_result_mapping(
1819
results_file.read_text(encoding=sys.getdefaultencoding())
1920
)
2021

2122

22-
def read_grades_file(grades_file):
23+
def read_grades_file(grades_file: pathlib.Path):
2324
if not grades_file.is_file():
24-
raise plug.PlugError("no such file: {}".format(str(grades_file)))
25+
raise plug.PlugError(f"no such file: {str(grades_file)}")
2526
with open(
26-
str(grades_file), encoding=sys.getdefaultencoding(), mode="r"
27+
grades_file, encoding=sys.getdefaultencoding(), mode="r"
2728
) as file:
2829
grades_file_contents = [
2930
[cell.strip() for cell in row]

repobee_csvgrades/_marker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ def mark_grades(
113113

114114

115115
def extract_list_issues_results(
116-
repo_name, hook_results: List[plug.HookResult]
117-
) -> plug.HookResult:
116+
repo_name, hook_results: List[plug.Result]
117+
) -> plug.Result:
118118
for result in hook_results:
119-
if result.hook == "list-issues":
119+
if result.name == "list-issues":
120120
return result
121121
raise plug.PlugError(
122122
"hook results for {} does not contain 'list-issues' result".format(

0 commit comments

Comments
 (0)