WIP: improve model version deps

This commit is contained in:
Ines Montani 2020-05-28 12:51:37 +02:00
parent a44d51a3d8
commit 4fd087572a
2 changed files with 10 additions and 1 deletions

View File

@ -138,7 +138,7 @@ def list_files(data_dir):
def list_requirements(meta):
parent_package = meta.get('parent_package', 'spacy')
requirements = [parent_package + meta['spacy_version']]
requirements = [parent_package + '>=' + meta['spacy_version']]
if 'setup_requires' in meta:
requirements += meta['setup_requires']
if 'requirements' in meta:

View File

@ -265,6 +265,15 @@ def is_compatible_model(meta):
return True
def get_model_version_range(version):
"""Generate a version range like >=1.2.3,<1.3.0 based on a given spaCy
version. Models are always compatible across patch versions but not
across minor or major versions.
"""
major, minor = split_version(version)
return f">={version},<{major}.{minor + 1}.0"
def load_config(path, create_objects=False):
"""Load a Thinc-formatted config file, optionally filling in objects where
the config references registry entries. See "Thinc config files" for details.