Add docstring and todo note
@@ -107,6 +107,13 @@ def read_json(location):
def parse_package_meta(package_path, package, require=True):
+ """
+ Check if a meta.json exists in a package and return its contents as a
+ dictionary. If require is set to True, raise an error if no meta.json found.
+ """
+ # TODO: Allow passing in full model path and only require one argument
+ # instead of path and package name. This lets us avoid passing in an awkward
+ # empty string in spacy.load() if user supplies full model path.
location = package_path / package / 'meta.json'
if location.is_file():
return read_json(location)
