From a1a32f6230c787a94fcf82ed2bae1c5bf9716e9c Mon Sep 17 00:00:00 2001 From: tzutalin Date: Sat, 25 May 2019 20:58:20 -0700 Subject: [PATCH] Update README.md and setup.py --- HISTORY.rst | 7 +++++- Makefile | 12 ++++++--- README.rst | 59 ++++++++++++++++++++------------------------ libs/__init__.py | 2 +- setup.py | 64 ++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 93 insertions(+), 51 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 78b1b5cf..77fb2e5c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,7 +1,12 @@ -======= History ======= +1.8.2 (2018-12-02) +------------------ + +* Fix pip depolyment issue + + 1.8.1 (2018-12-02) ------------------ diff --git a/Makefile b/Makefile index cb4205f8..7d72a890 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # ex: set ts=8 noet: -all: qt5 +all: qt5 test test: testpy3 @@ -24,6 +24,12 @@ qt5py3: pyrcc5 -o libs/resources.py resources.qrc clean: - rm -f ~/.labelImgSettings.pkl resources.pyc + rm -rf ~/.labelImgSettings.pkl *.pyc dist labelImg.egg-info __pycache__ build -.PHONY: test +pip_upload: + python3 setup.py upload + +long_description: + restview --long-description + +.PHONY: all diff --git a/README.rst b/README.rst index 2f80483c..b77ce842 100644 --- a/README.rst +++ b/README.rst @@ -16,7 +16,7 @@ LabelImg is a graphical image annotation tool. It is written in Python and uses Qt for its graphical interface. Annotations are saved as XML files in PASCAL VOC format, the format used -by `ImageNet `__. Besdies, it also supports YOLO format +by `ImageNet `__. Besides, it also supports YOLO format .. image:: https://raw.githubusercontent.com/tzutalin/labelImg/master/demo/demo3.jpg :alt: Demo Image @@ -29,19 +29,14 @@ by `ImageNet `__. Besdies, it also supports YOLO for Installation ------------------ -Download prebuilt binaries -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -- `Windows `__ - -- macOS. Binaries for macOS are not yet available. Help would be appreciated. At present, it must be `built from source <#macos>`__. Build from source ~~~~~~~~~~~~~~~~~ Linux/Ubuntu/Mac requires at least `Python 2.6 `__ and has been tested with `PyQt -4.8 `__. +4.8 `__. However, `Python +3 or above `__ and `PyQt5 `__ are strongly recommended. Ubuntu Linux @@ -56,7 +51,7 @@ Python 2 + Qt4 python labelImg.py python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] -Python 3 + Qt5 (Recommanded) +Python 3 + Qt5 (Recommended) .. code:: shell @@ -78,14 +73,14 @@ Python 2 + Qt4 python labelImg.py python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] -Python 3 + Qt5 (Recommanded) +Python 3 + Qt5 (Recommended) .. code:: shell brew install qt # Install qt-5.x.x by Homebrew brew install libxml2 - or + or using pip pip3 install pyqt5 lxml # Install qt and lxml by pip @@ -94,23 +89,21 @@ Python 3 + Qt5 (Recommanded) python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] -**NEW** Python 3 Virtualenv + Binary +Python 3 Virtualenv (Recommended) -This can avoid a lot of the QT / Python version issues, and gives you a nice .app file with a new SVG Icon -in your /Applications folder. You can consider this script: build-tools/build-for-macos.sh +Virtualenv can avoid a lot of the QT / Python version issues .. code:: shell brew install python3 - pip install pipenv - pipenv --three - pipenv shell - pip install py2app - pip install PyQt5 lxml - make qt5py3 - rm -rf build dist - python setup.py py2app -A - mv "dist/labelImg.app" /Applications + pip3 install pipenv + pipenv --three # or pipenv install pyqt5 lxml + pipenv run pip install pyqt5 lxml + pipenv run make qt5py3 + python3 labelImg.py + [Optional] rm -rf build dist; python setup.py py2app -A;mv "dist/labelImg.app" /Applications + +Note: The Last command gives you a nice .app file with a new SVG Icon in your /Applications folder. You can consider using the script: build-tools/build-for-macos.sh Windows @@ -142,15 +135,14 @@ Open the Anaconda Prompt and go to the `labelImg <#labelimg>`__ directory python labelImg.py python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] -Get from PyPI -~~~~~~~~~~~~~~~~~ +Get from PyPI but only python3.0 or above +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code:: shell - pip install labelImg + pip3 install labelImg labelImg labelImg [IMAGE_PATH] [PRE-DEFINED CLASS FILE] -I tested pip on Ubuntu 14.04 and 16.04. However, I didn't test pip on macOS and Windows Use Docker ~~~~~~~~~~~~~~~~~ @@ -198,15 +190,15 @@ Steps (YOLO) 2. Build and launch using the instructions above. -3. Right below "Save" button in toolbar, click "PascalVOC" button to switch to YOLO format. +3. Right below "Save" button in the toolbar, click "PascalVOC" button to switch to YOLO format. -4. You may use Open/OpenDIR to process single or multiple images. When finished with single image, click save. +4. You may use Open/OpenDIR to process single or multiple images. When finished with a single image, click save. -A txt file of yolo format will be saved in the same folder as your image with same name. A file named "classes.txt" is saved to that folder too. "classes.txt" defines the list of class names that your yolo label refers to. +A txt file of YOLO format will be saved in the same folder as your image with same name. A file named "classes.txt" is saved to that folder too. "classes.txt" defines the list of class names that your YOLO label refers to. Note: -- Your label list shall not change in the middle of processing a list of images. When you save a image, classes.txt will also get updated, while previous annotations will not be updated. +- Your label list shall not change in the middle of processing a list of images. When you save an image, classes.txt will also get updated, while previous annotations will not be updated. - You shouldn't use "default class" function when saving to YOLO format, it will not be referred. @@ -255,7 +247,7 @@ This is used when creating a dataset automatically, the user can then through al **Difficult:** -The difficult field being set to 1 indicates that the object has been annotated as "difficult", for example an object which is clearly visible but difficult to recognize without substantial use of context. +The difficult field is set to 1 indicates that the object has been annotated as "difficult", for example, an object which is clearly visible but difficult to recognize without substantial use of context. According to your deep neural network implementation, you can include or exclude difficult objects during training. How to contribute @@ -276,6 +268,7 @@ Related download image, create a label text for machine learning, etc 2. `Use Docker to run labelImg `__ 3. `Generating the PASCAL VOC TFRecord files `__ -4. `App Icon based on Icon by Nick Roach (GPL)` __ +4. `App Icon based on Icon by Nick Roach (GPL) `__ +5. `Setup python development in vscode `__ diff --git a/libs/__init__.py b/libs/__init__.py index af9f86bb..d4e244b4 100644 --- a/libs/__init__.py +++ b/libs/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ('1', '8', '1') +__version_info__ = ('1', '8', '2') __version__ = '.'.join(__version_info__) diff --git a/setup.py b/setup.py index 348c899c..a765bf6a 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,8 @@ import os here = os.path.abspath(os.path.dirname(__file__)) NAME = 'labelImg' +REQUIRES_PYTHON = '>=3.0.0' +REQUIRED_DEP = ['pyqt5', 'lxml'] about = {} with open(os.path.join(here, 'libs', '__init__.py')) as f: @@ -21,14 +23,6 @@ with open('HISTORY.rst') as history_file: history = history_file.read() -REQUIRED = [] - -if (sys.version_info > (3, 0)): - REQUIRED = ['pyqt5', 'lxml'] -else: - print('\033[93m For py2, you are unable to installl pyqt4 by pip \033[0m') - REQUIRED = ['lxml'] - # OS specific settings SET_REQUIRES = [] if _platform == "linux" or _platform == "linux2": @@ -47,6 +41,47 @@ OPTIONS = { 'iconfile': 'resources/icons/app.icns' } +class UploadCommand(Command): + """Support setup.py upload.""" + + description=readme + '\n\n' + history, + + user_options = [] + + @staticmethod + def status(s): + """Prints things in bold.""" + print('\033[1m{0}\033[0m'.format(s)) + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + try: + self.status('Removing previous builds…') + rmtree(os.path.join(here, 'dist')) + except OSError: + self.status('Fail to remove previous builds..') + pass + + self.status('Building Source and Wheel (universal) distribution…') + os.system( + '{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) + + self.status('Uploading the package to PyPI via Twine…') + os.system('twine upload dist/*') + + self.status('Pushing git tags…') + os.system('git tag -d v{0}'.format(about['__version__'])) + os.system('git tag v{0}'.format(about['__version__'])) + # os.system('git push --tags') + + sys.exit() + + setup( app=APP, name=NAME, @@ -56,6 +91,7 @@ setup( author="TzuTa Lin", author_email='tzu.ta.lin@gmail.com', url='https://github.com/tzutalin/labelImg', + python_requires=REQUIRES_PYTHON, package_dir={'labelImg': '.'}, packages=required_packages, entry_points={ @@ -64,7 +100,7 @@ setup( ] }, include_package_data=True, - install_requires=REQUIRED, + install_requires=REQUIRED_DEP, license="MIT license", zip_safe=False, keywords='labelImg labelTool development annotation deeplearning', @@ -73,16 +109,18 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', - "Programming Language :: Python :: 2", - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', ], package_data={'data/predefined_classes.txt': ['data/predefined_classes.txt']}, options={'py2app': OPTIONS}, - setup_requires= SET_REQUIRES + setup_requires=SET_REQUIRES, + # $ setup.py publish support. + cmdclass={ + 'upload': UploadCommand, + } )