From 3c1fb9d02d55066ce7dd30e554204c57cdd04710 Mon Sep 17 00:00:00 2001 From: ines Date: Wed, 31 Jan 2018 22:06:28 +0100 Subject: [PATCH] Make validate command fail more gracefully if version not found Mostly relevant during develoment when working with .dev versions --- spacy/cli/validate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spacy/cli/validate.py b/spacy/cli/validate.py index f96f7683e..b83753509 100644 --- a/spacy/cli/validate.py +++ b/spacy/cli/validate.py @@ -20,13 +20,16 @@ def validate(): prints("Couldn't fetch compatibility table.", title="Server error (%d)" % r.status_code, exits=1) compat = r.json()['spacy'] + current_compat = compat.get(about.__version__) + if not current_compat: + prints(about.__compatibility__, exits=1, + title="Can't find spaCy v{} in compatibility table" + .format(about.__version__)) all_models = set() for spacy_v, models in dict(compat).items(): all_models.update(models.keys()) for model, model_vs in models.items(): compat[spacy_v][model] = [reformat_version(v) for v in model_vs] - - current_compat = compat[about.__version__] model_links = get_model_links(current_compat) model_pkgs = get_model_pkgs(current_compat, all_models) incompat_links = {l for l, d in model_links.items() if not d['compat']}