mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
Support full prerelease versions in the compat table (#11228)
* Support full prerelease versions in the compat table * Fix types
This commit is contained in:
parent
cd09614ab2
commit
b07708d5d0
|
@ -7,6 +7,7 @@ import typer
|
||||||
from ._util import app, Arg, Opt, WHEEL_SUFFIX, SDIST_SUFFIX
|
from ._util import app, Arg, Opt, WHEEL_SUFFIX, SDIST_SUFFIX
|
||||||
from .. import about
|
from .. import about
|
||||||
from ..util import is_package, get_minor_version, run_command
|
from ..util import is_package, get_minor_version, run_command
|
||||||
|
from ..util import is_prerelease_version
|
||||||
from ..errors import OLD_MODEL_SHORTCUTS
|
from ..errors import OLD_MODEL_SHORTCUTS
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +75,10 @@ def download(model: str, direct: bool = False, sdist: bool = False, *pip_args) -
|
||||||
|
|
||||||
|
|
||||||
def get_compatibility() -> dict:
|
def get_compatibility() -> dict:
|
||||||
version = get_minor_version(about.__version__)
|
if is_prerelease_version(about.__version__):
|
||||||
|
version: Optional[str] = about.__version__
|
||||||
|
else:
|
||||||
|
version = get_minor_version(about.__version__)
|
||||||
r = requests.get(about.__compatibility__)
|
r = requests.get(about.__compatibility__)
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
msg.fail(
|
msg.fail(
|
||||||
|
|
|
@ -795,6 +795,15 @@ def get_model_lower_version(constraint: str) -> Optional[str]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def is_prerelease_version(version: str) -> bool:
|
||||||
|
"""Check whether a version is a prerelease version.
|
||||||
|
|
||||||
|
version (str): The version, e.g. "3.0.0.dev1".
|
||||||
|
RETURNS (bool): Whether the version is a prerelease version.
|
||||||
|
"""
|
||||||
|
return Version(version).is_prerelease
|
||||||
|
|
||||||
|
|
||||||
def get_base_version(version: str) -> str:
|
def get_base_version(version: str) -> str:
|
||||||
"""Generate the base version without any prerelease identifiers.
|
"""Generate the base version without any prerelease identifiers.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user