Skip to content

Commit

Permalink
[Refactor] Specify mmengine version (open-mmlab#1715)
Browse files Browse the repository at this point in the history
* specify mmengine version

* fix denpendency version
  • Loading branch information
Ben-Louis authored and ly015 committed Oct 14, 2022
1 parent 1f728a6 commit 6cd9ed1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
24 changes: 11 additions & 13 deletions mmpose/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import mmengine
from mmengine.utils import digit_version

from .version import __version__, short_version


def digit_version(version_str):
digit_version = []
for x in version_str.split('.'):
if x.isdigit():
digit_version.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
digit_version.append(int(patch_version[0]) - 1)
digit_version.append(int(patch_version[1]))
return digit_version


mmcv_minimum_version = '2.0.0rc0'
mmcv_maximum_version = '2.1.0'
mmcv_version = digit_version(mmcv.__version__)

mmengine_minimum_version = '0.1.0'
mmengine_maximum_version = '1.0.0'
mmengine_version = digit_version(mmengine.__version__)

assert (mmcv_version >= digit_version(mmcv_minimum_version)
and mmcv_version <= digit_version(mmcv_maximum_version)), \
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'

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}.'

__all__ = ['__version__', 'short_version']
8 changes: 8 additions & 0 deletions mmpose/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@


def parse_version_info(version_str):
"""Parse a version string into a tuple.
Args:
version_str (str): The version string.
Returns:
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into
(1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1').
"""
version_info = []
for x in version_str.split('.'):
if x.isdigit():
Expand Down
1 change: 1 addition & 0 deletions requirements/poseval.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
poseval@git+https://github.com/svenkreiss/poseval.git
shapely==1.8.4

0 comments on commit 6cd9ed1

Please sign in to comment.