setup.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. from setuptools import find_packages
  2. from setuptools import setup
  3. import shlex
  4. import subprocess
  5. import sys
  6. PY3 = sys.version_info[0] == 3
  7. PY2 = sys.version_info[0] == 2
  8. assert PY3 or PY2
  9. version = '2.12.0'
  10. install_requires = [
  11. 'matplotlib',
  12. 'numpy',
  13. 'Pillow>=2.8.0',
  14. 'PyYAML',
  15. 'qtpy',
  16. ]
  17. # Find python binding for qt with priority:
  18. # PyQt5 -> PySide2 -> PyQt4,
  19. # and PyQt5 is automatically installed on Python3.
  20. QT_BINDING = None
  21. try:
  22. import PyQt5 # NOQA
  23. QT_BINDING = 'pyqt5'
  24. except ImportError:
  25. pass
  26. if QT_BINDING is None:
  27. try:
  28. import PySide2 # NOQA
  29. QT_BINDING = 'pyside2'
  30. except ImportError:
  31. pass
  32. if QT_BINDING is None:
  33. try:
  34. import PyQt4 # NOQA
  35. QT_BINDING = 'pyqt4'
  36. except ImportError:
  37. if PY2:
  38. sys.stderr.write(
  39. 'Please install PyQt5, PySide2 or PyQt4 for Python2.\n'
  40. 'Note that PyQt5 can be installed via pip for Python3.')
  41. sys.exit(1)
  42. assert PY3
  43. # PyQt5 can be installed via pip for Python3
  44. install_requires.append('pyqt5')
  45. QT_BINDING = 'pyqt5'
  46. del QT_BINDING
  47. if sys.argv[1] == 'release':
  48. commands = [
  49. 'git tag v{:s}'.format(version),
  50. 'git push origin master --tag',
  51. 'python setup.py sdist',
  52. 'twine upload dist/labelme-{:s}.tar.gz'.format(version),
  53. ]
  54. sys.exit(sum(subprocess.call(shlex.split(cmd)) for cmd in commands))
  55. setup(
  56. name='labelme',
  57. version=version,
  58. packages=find_packages(),
  59. description='Image Polygonal Annotation with Python.',
  60. long_description=open('README.md').read(),
  61. long_description_content_type='text/markdown',
  62. author='Kentaro Wada',
  63. author_email='www.kentaro.wada@gmail.com',
  64. url='https://github.com/wkentaro/labelme',
  65. install_requires=install_requires,
  66. license='GPLv3',
  67. keywords='Image Annotation, Machine Learning',
  68. classifiers=[
  69. 'Development Status :: 5 - Production/Stable',
  70. 'Intended Audience :: Developers',
  71. 'License :: OSI Approved :: MIT License',
  72. 'Operating System :: POSIX',
  73. 'Topic :: Internet :: WWW/HTTP',
  74. ],
  75. package_data={'labelme': ['icons/*', 'config/*.yaml']},
  76. entry_points={
  77. 'console_scripts': [
  78. 'labelme=labelme.app:main',
  79. 'labelme_draw_json=labelme.cli.draw_json:main',
  80. 'labelme_draw_label_png=labelme.cli.draw_label_png:main',
  81. 'labelme_json_to_dataset=labelme.cli.json_to_dataset:main',
  82. 'labelme_on_docker=labelme.cli.on_docker:main',
  83. ],
  84. },
  85. )