Export plugin¶
New in version 0.4.0.
Many instructors need to be able to get grades for their class out of the nbgrader database and into another format, such as a CSV file, a learning management system (LMS) like Canvas or Blackboard, etc. nbgrader comes with the capability to export grades to a CSV file, however you may want to customize this functionality for your own needs.
Creating a plugin¶
To add your own grade exporter you can create a plugin class that inherits from
nbgrader.plugins.ExportPlugin
. This class needs to only implement one
method, which is the export()
method (see
below). Let’s say you create your own plugin in the myexporter.py
file, and
your plugin is called MyExporter
. Then, on the command line, you would
run:
nbgrader export --exporter=myexporter.MyExporter
which will use your custom exporter rather than the built-in CSV exporter. For an example of how to interface with the database, please see Getting information from the database.
API¶
- class nbgrader.plugins.export.ExportPlugin(**kwargs)[source]¶
Base class for export plugins.
- export(gradebook)[source]¶
Export grades to another format.
This method MUST be implemented by subclasses. Users should be able to pass the
--to
flag on the command line, which will set theself.to
variable. By default, this variable will be an empty string, which allows you to specify whatever default you would like.