If I currently run explain on a set of issues, the return is not that useful since it is a string with markup for formatting:
import check_datapackage as cdp
package_properties = cdp.example_package_properties()
del package_properties["resources"][0]["path"]
issues = cdp.check(properties=package_properties)
cdp.explain(issues)
If we want explain to be used this way, I think we need to rethink the output from it both with and without error=True. A few guiding questions:
- Do we want
explain to be a public function runnable from code by the user or a helper function to nicely format DataPackageError?
- Currently, we have hardcoded the path
datapackage.json in the explain output, that would need to change if explain is a public function that is run on other input than this json file.
- If explain is a public function, should it return a string that the user can do something with or just print a helpful message.
- If explain is a public function runnable from code, then how should it interface with
DataPackageError?
- E.g. if we add a print directly in explain and then run
check(..., error=True), all the printed output from explain will appear above the line that says DataPackageError, something like this:

Tagging @martonvago and @lwjohnst86 since we worked on the explain implementation.