diff --git a/spacy/cli/package.py b/spacy/cli/package.py index 26ce01a18..1abc36837 100644 --- a/spacy/cli/package.py +++ b/spacy/cli/package.py @@ -26,6 +26,7 @@ def package(input_dir, output_dir, meta_path, force): else: meta = generate_meta() + validate_meta(meta, ['lang', 'name', 'version']) model_name = meta['lang'] + '_' + meta['name'] model_name_v = model_name + '-' + meta['version'] main_path = output_path / model_name_v @@ -89,6 +90,14 @@ def generate_meta(): return meta +def validate_meta(meta, keys): + for key in keys: + if key not in meta or meta[key] == '': + util.sys_exit( + "This setting is required to build your package.", + title='No "{k}" setting found in meta.json'.format(k=key)) + + def get_template(filepath): url = 'https://raw.githubusercontent.com/explosion/spacy-dev-resources/master/templates/model/' r = requests.get(url + filepath)