From c44b611a6cc5c6f59d06b5b7c7abc35e91d165b2 Mon Sep 17 00:00:00 2001 From: Tong Gao Date: Thu, 1 Sep 2022 14:27:53 +0800 Subject: [PATCH] Bump version to 1.0.0rc0 (#1363) * Bump version to 1.0.0rc0 * update init Co-authored-by: xinyu --- mmocr/__init__.py | 54 ++++++++---------------------------- requirements/readthedocs.txt | 5 ++-- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/mmocr/__init__.py b/mmocr/__init__.py index 06cef5d46..614293215 100644 --- a/mmocr/__init__.py +++ b/mmocr/__init__.py @@ -1,54 +1,18 @@ # Copyright (c) OpenMMLab. All rights reserved. -import warnings import mmcv import mmdet -from packaging.version import parse +import mmengine +from mmengine.utils import digit_version from .version import __version__, short_version - -def digit_version(version_str: str, length: int = 4): - """Convert a version string into a tuple of integers. - - This method is usually used for comparing two versions. For pre-release - versions: alpha < beta < rc. - Args: - version_str (str): The version string. - length (int): The maximum number of version levels. Default: 4. - Returns: - tuple[int]: The version info in digits (integers). - """ - version = parse(version_str) - assert version.release, f'failed to parse version {version_str}' - release = list(version.release) - release = release[:length] - if len(release) < length: - release = release + [0] * (length - len(release)) - if version.is_prerelease: - mapping = {'a': -3, 'b': -2, 'rc': -1} - val = -4 - # version.pre can be None - if version.pre: - if version.pre[0] not in mapping: - warnings.warn(f'unknown prerelease version {version.pre[0]}, ' - 'version checking may go wrong') - else: - val = mapping[version.pre[0]] - release.extend([val, version.pre[-1]]) - else: - release.extend([val, 0]) - - elif version.is_postrelease: - release.extend([1, version.post]) - else: - release.extend([0, 0]) - return tuple(release) - - -mmcv_minimum_version = '2.0.0rc0' +mmcv_minimum_version = '2.0.0rc1' mmcv_maximum_version = '2.1.0' mmcv_version = digit_version(mmcv.__version__) +mmengine_minimum_version = '0.0.0' +mmengine_maximum_version = '0.2.0' +mmengine_version = digit_version(mmengine.__version__) assert (mmcv_version >= digit_version(mmcv_minimum_version) and mmcv_version < digit_version(mmcv_maximum_version)), \ @@ -56,6 +20,12 @@ def digit_version(version_str: str, length: int = 4): f'Please use MMCV >= {mmcv_minimum_version}, ' \ f'< {mmcv_maximum_version} instead.' +assert (mmengine_version >= digit_version(mmengine_minimum_version) + and mmengine_version < digit_version(mmengine_maximum_version)), \ + f'MMEngine=={mmengine.__version__} is used but incompatible. ' \ + f'Please install mmengine>={mmengine_minimum_version}, ' \ + f'<{mmengine_maximum_version}.' + mmdet_minimum_version = '3.0.0rc0' mmdet_maximum_version = '3.1.0' mmdet_version = digit_version(mmdet.__version__) diff --git a/requirements/readthedocs.txt b/requirements/readthedocs.txt index f7ce08def..905a6a10c 100644 --- a/requirements/readthedocs.txt +++ b/requirements/readthedocs.txt @@ -3,8 +3,9 @@ kwarray lanms-neo==1.0.2 lmdb matplotlib -mmcv -mmdet +mmcv>=2.0.0rc1 +mmdet>=3.0.0rc0 +mmengine>=0.1.0 pyclipper rapidfuzz>=2.0.0 regex