From cf4ec88b38a3a2e6fc2c3c6ac100b007c741f538 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 4 Nov 2019 02:38:45 +0100 Subject: [PATCH] Use latest wasabi --- requirements.txt | 2 +- setup.cfg | 2 +- spacy/__main__.py | 4 +--- spacy/cli/download.py | 5 +---- spacy/cli/evaluate.py | 3 +-- spacy/cli/info.py | 3 +-- spacy/cli/init_model.py | 3 +-- spacy/cli/link.py | 3 +-- spacy/cli/package.py | 3 +-- spacy/cli/pretrain.py | 3 +-- spacy/cli/profile.py | 3 +-- spacy/cli/train.py | 3 +-- spacy/cli/validate.py | 3 +-- 13 files changed, 13 insertions(+), 27 deletions(-) diff --git a/requirements.txt b/requirements.txt index ad7059f3a..89118b970 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ preshed>=3.0.2,<3.1.0 thinc>=7.3.0,<7.4.0 blis>=0.4.0,<0.5.0 murmurhash>=0.28.0,<1.1.0 -wasabi>=0.3.0,<1.1.0 +wasabi>=0.4.0,<1.1.0 srsly>=0.1.0,<1.1.0 # Third party dependencies numpy>=1.15.0 diff --git a/setup.cfg b/setup.cfg index 51e722354..f8eac60fc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ install_requires = blis>=0.4.0,<0.5.0 plac>=0.9.6,<1.2.0 requests>=2.13.0,<3.0.0 - wasabi>=0.3.0,<1.1.0 + wasabi>=0.4.0,<1.1.0 srsly>=0.1.0,<1.1.0 pathlib==1.0.1; python_version < "3.4" importlib_metadata>=0.20; python_version < "3.8" diff --git a/spacy/__main__.py b/spacy/__main__.py index 716561566..2c285095e 100644 --- a/spacy/__main__.py +++ b/spacy/__main__.py @@ -7,12 +7,10 @@ from __future__ import print_function if __name__ == "__main__": import plac import sys - from wasabi import Printer + from wasabi import msg from spacy.cli import download, link, info, package, train, pretrain, convert from spacy.cli import init_model, profile, evaluate, validate, debug_data - msg = Printer() - commands = { "download": download, "link": link, diff --git a/spacy/cli/download.py b/spacy/cli/download.py index c57e2364b..19f3e7860 100644 --- a/spacy/cli/download.py +++ b/spacy/cli/download.py @@ -6,16 +6,13 @@ import requests import os import subprocess import sys -from wasabi import Printer +from wasabi import msg from .link import link from ..util import get_package_path from .. import about -msg = Printer() - - @plac.annotations( model=("Model to download (shortcut or name)", "positional", None, str), direct=("Force direct download of name + version", "flag", "d", bool), diff --git a/spacy/cli/evaluate.py b/spacy/cli/evaluate.py index 1114ada08..c24e37038 100644 --- a/spacy/cli/evaluate.py +++ b/spacy/cli/evaluate.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals, division, print_function import plac from timeit import default_timer as timer -from wasabi import Printer +from wasabi import msg from ..gold import GoldCorpus from .. import util @@ -32,7 +32,6 @@ def evaluate( Evaluate a model. To render a sample of parses in a HTML file, set an output directory as the displacy_path argument. """ - msg = Printer() util.fix_random_seed() if gpu_id >= 0: util.use_gpu(gpu_id) diff --git a/spacy/cli/info.py b/spacy/cli/info.py index 3655327ef..080d0dc77 100644 --- a/spacy/cli/info.py +++ b/spacy/cli/info.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import plac import platform from pathlib import Path -from wasabi import Printer +from wasabi import msg import srsly from ..compat import path2str, basestring_, unicode_ @@ -23,7 +23,6 @@ def info(model=None, markdown=False, silent=False): speficied as an argument, print model information. Flag --markdown prints details in Markdown for easy copy-pasting to GitHub issues. """ - msg = Printer() if model: if util.is_package(model): model_path = util.get_package_path(model) diff --git a/spacy/cli/init_model.py b/spacy/cli/init_model.py index c285a12a6..cda21cbcc 100644 --- a/spacy/cli/init_model.py +++ b/spacy/cli/init_model.py @@ -11,7 +11,7 @@ import tarfile import gzip import zipfile import srsly -from wasabi import Printer +from wasabi import msg from ..vectors import Vectors from ..errors import Errors, Warnings, user_warning @@ -24,7 +24,6 @@ except ImportError: DEFAULT_OOV_PROB = -20 -msg = Printer() @plac.annotations( diff --git a/spacy/cli/link.py b/spacy/cli/link.py index 6b719ffe6..8117829b5 100644 --- a/spacy/cli/link.py +++ b/spacy/cli/link.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import plac from pathlib import Path -from wasabi import Printer +from wasabi import msg from ..compat import symlink_to, path2str from .. import util @@ -20,7 +20,6 @@ def link(origin, link_name, force=False, model_path=None): either the name of a pip package, or the local path to the model data directory. Linking models allows loading them via spacy.load(link_name). """ - msg = Printer() if util.is_package(origin): model_path = util.get_package_path(origin) else: diff --git a/spacy/cli/package.py b/spacy/cli/package.py index e99a6d5ff..8ed92259c 100644 --- a/spacy/cli/package.py +++ b/spacy/cli/package.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import plac import shutil from pathlib import Path -from wasabi import Printer, get_raw_input +from wasabi import msg, get_raw_input import srsly from ..compat import path2str @@ -27,7 +27,6 @@ def package(input_dir, output_dir, meta_path=None, create_meta=False, force=Fals set and a meta.json already exists in the output directory, the existing values will be used as the defaults in the command-line prompt. """ - msg = Printer() input_path = util.ensure_path(input_dir) output_path = util.ensure_path(output_dir) meta_path = util.ensure_path(meta_path) diff --git a/spacy/cli/pretrain.py b/spacy/cli/pretrain.py index f7236f7de..c1aade2b2 100644 --- a/spacy/cli/pretrain.py +++ b/spacy/cli/pretrain.py @@ -11,7 +11,7 @@ from pathlib import Path from thinc.v2v import Affine, Maxout from thinc.misc import LayerNorm as LN from thinc.neural.util import prefer_gpu -from wasabi import Printer +from wasabi import msg import srsly from ..errors import Errors @@ -122,7 +122,6 @@ def pretrain( for key in config: if isinstance(config[key], Path): config[key] = str(config[key]) - msg = Printer() util.fix_random_seed(seed) has_gpu = prefer_gpu() diff --git a/spacy/cli/profile.py b/spacy/cli/profile.py index 201ab13d5..4995224f3 100644 --- a/spacy/cli/profile.py +++ b/spacy/cli/profile.py @@ -9,7 +9,7 @@ import pstats import sys import itertools import thinc.extra.datasets -from wasabi import Printer +from wasabi import msg from ..util import load_model @@ -26,7 +26,6 @@ def profile(model, inputs=None, n_texts=10000): It can either be provided as a JSONL file, or be read from sys.sytdin. If no input file is specified, the IMDB dataset is loaded via Thinc. """ - msg = Printer() if inputs is not None: inputs = _read_inputs(inputs, msg) if inputs is None: diff --git a/spacy/cli/train.py b/spacy/cli/train.py index 13fcae37f..d1fbdd179 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -8,7 +8,7 @@ from thinc.neural._classes.model import Model from timeit import default_timer as timer import shutil import srsly -from wasabi import Printer +from wasabi import msg import contextlib import random @@ -89,7 +89,6 @@ def train( # temp fix to avoid import issues cf https://github.com/explosion/spaCy/issues/4200 import tqdm - msg = Printer() util.fix_random_seed() util.set_env_log(verbose) diff --git a/spacy/cli/validate.py b/spacy/cli/validate.py index 38f8d2313..93abad6f6 100644 --- a/spacy/cli/validate.py +++ b/spacy/cli/validate.py @@ -5,7 +5,7 @@ from pathlib import Path import sys import requests import srsly -from wasabi import Printer +from wasabi import msg from ..compat import path2str from ..util import get_data_path @@ -17,7 +17,6 @@ def validate(): Validate that the currently installed version of spaCy is compatible with the installed models. Should be run after `pip install -U spacy`. """ - msg = Printer() with msg.loading("Loading compatibility table..."): r = requests.get(about.__compatibility__) if r.status_code != 200: