bump version to 0.6.0 (#62)

* fix lint

* fix version path type

* del short_version

* setup: del ops; add python3.8

* del useless requirements

* setup: remove extra_requirements

* setup: totally remove build_requests

* setup: change to valid email
pull/64/head
Y. Xiong 2020-10-11 00:12:04 +08:00 committed by GitHub
parent c00ee6a876
commit d369645e23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 104 deletions

1
.gitignore vendored
View File

@ -105,7 +105,6 @@ venv.bak/
.mypy_cache/ .mypy_cache/
# custom # custom
mmcls/version.py
data data
.vscode .vscode
.idea .idea

View File

@ -1 +0,0 @@
0.1.0

View File

@ -1,3 +1,3 @@
from .version import __version__, short_version from .version import __version__
__all__ = ['__version__', 'short_version'] __all__ = ['__version__']

27
mmcls/version.py 100644
View File

@ -0,0 +1,27 @@
# Copyright (c) Open-MMLab. All rights reserved.
__version__ = '0.6.0'
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():
version_info.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
version_info.append(int(patch_version[0]))
version_info.append(f'rc{patch_version[1]}')
return tuple(version_info)
version_info = parse_version_info(__version__)
__all__ = ['__version__', 'version_info', 'parse_version_info']

View File

@ -1 +0,0 @@
numpy

125
setup.py
View File

@ -1,6 +1,3 @@
import os
import subprocess
import time
from setuptools import find_packages, setup from setuptools import find_packages, setup
@ -10,71 +7,9 @@ def readme():
return content return content
version_file = 'mmcls/version.py'
def get_git_hash():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH', 'HOME']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
sha = out.strip().decode('ascii')
except OSError:
sha = 'unknown'
return sha
def get_hash():
if os.path.exists('.git'):
sha = get_git_hash()[:7]
elif os.path.exists(version_file):
try:
from mmcls.version import __version__
sha = __version__.split('+')[-1]
except ImportError:
raise ImportError('Unable to get git version')
else:
sha = 'unknown'
return sha
def write_version_py():
content = """# GENERATED VERSION FILE
# TIME: {}
__version__ = '{}'
short_version = '{}'
version_info = ({})
"""
sha = get_hash()
with open('mmcls/VERSION', 'r') as f:
SHORT_VERSION = f.read().strip()
VERSION_INFO = ', '.join(SHORT_VERSION.split('.'))
VERSION = SHORT_VERSION + '+' + sha
version_file_str = content.format(time.asctime(), VERSION, SHORT_VERSION,
VERSION_INFO)
with open(version_file, 'w') as f:
f.write(version_file_str)
def get_version(): def get_version():
with open(version_file, 'r') as f: version_file = 'mmcls/version.py'
with open(version_file, 'r', encoding='utf-8') as f:
exec(compile(f.read(), version_file, 'exec')) exec(compile(f.read(), version_file, 'exec'))
return locals()['__version__'] return locals()['__version__']
@ -155,35 +90,27 @@ def parse_requirements(fname='requirements.txt', with_version=True):
return packages return packages
if __name__ == '__main__': setup(
write_version_py() name='mmcls',
setup( version=get_version(),
name='mmcls', description='OpenMMLab Image Classification Toolbox and Benchmark',
version=get_version(), long_description=readme(),
description='OpenMMLab Image Classification Toolbox and Benchmark', author='OpenMMLab',
long_description=readme(), author_email='openmmlab@gmail.com',
author='OpenMMLab', keywords='computer vision, image classification',
author_email='yangleidev@gmail.com', url='https://github.com/open-mmlab/mmclassification',
keywords='computer vision, image classification', packages=find_packages(exclude=('configs', 'tools', 'demo')),
url='https://github.com/open-mmlab/mmclassification', classifiers=[
packages=find_packages(exclude=('configs', 'tools', 'demo')), 'Development Status :: 4 - Beta',
package_data={'mmcls.ops': ['*/*.so']}, 'License :: OSI Approved :: Apache Software License',
classifiers=[ 'Operating System :: OS Independent',
'Development Status :: 4 - Beta', 'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 3.5',
'Operating System :: OS Independent', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.6', ],
'Programming Language :: Python :: 3.7', license='Apache License 2.0',
], tests_require=parse_requirements('requirements/tests.txt'),
license='Apache License 2.0', install_requires=parse_requirements('requirements/runtime.txt'),
setup_requires=parse_requirements('requirements/build.txt'), zip_safe=False)
tests_require=parse_requirements('requirements/tests.txt'),
install_requires=parse_requirements('requirements/runtime.txt'),
extras_require={
'all': parse_requirements('requirements.txt'),
'tests': parse_requirements('requirements/tests.txt'),
'build': parse_requirements('requirements/build.txt'),
},
zip_safe=False)