Skip to content

Commit

Permalink
Make validate command fail more gracefully if version not found
Browse files Browse the repository at this point in the history
Mostly relevant during develoment when working with .dev versions
  • Loading branch information
ines committed Jan 31, 2018
1 parent 2e73d66 commit 3c1fb9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spacy/cli/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}
Expand Down

0 comments on commit 3c1fb9d

Please sign in to comment.