Skip to content

Commit b902855

Browse files
authoredFeb 20, 2020
AC: install core components command (openvinotoolkit#872)
1 parent ac6339b commit b902855

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed
 

‎tools/accuracy_checker/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ If all prerequisite are installed, then you are ready to install **accuracy chec
6161
python3 setup.py install
6262
```
6363

64-
Accuracy Checker is modular tool and have some task-specific dependencies, all required modules can be found in `requirements.in` file.
65-
You can install tool without dependencies and manage them by your-self using following command instead of standard installation:
64+
Accuracy Checker is modular tool and have some task-specific dependencies, all specific required modules can be found in `requirements.in` file.
65+
You can install only core part of the tool without additional dependencies and manage them by your-self using following command instead of standard installation:
6666

6767
```bash
68-
pip install . --no-dependencies
68+
python setup.py install_core
6969
```
7070

7171
#### Usage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# core components
2+
numpy>=1.11,<1.18
3+
PyYAML

‎tools/accuracy_checker/requirements.in

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# core components
2-
numpy>=1.11,<1.18
3-
PyYAML
4-
51
# progress bar
62
tqdm
73

‎tools/accuracy_checker/setup.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import importlib
1818
import re
1919
import sys
20+
import warnings
2021
from setuptools import find_packages, setup
2122
from setuptools.command.test import test as test_command
23+
from setuptools.command.install import install as install_command
2224
from pathlib import Path
2325

2426

@@ -44,6 +46,10 @@ def read(*path):
4446
return file.read()
4547

4648

49+
class CoreInstall(install_command):
50+
pass
51+
52+
4753
def find_version(*path):
4854
version_file = read(*path)
4955
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
@@ -56,11 +62,14 @@ def find_version(*path):
5662
long_description = read("README.md")
5763
version = find_version("accuracy_checker", "__init__.py")
5864

59-
requirements = [read("requirements.in")]
65+
requirements = [read('requirements-core.in') + read("requirements.in") if 'install_core' not in sys.argv else '']
6066

6167
try:
6268
importlib.import_module('cv2')
63-
except ImportError:
69+
except ImportError as opencv_import_error:
70+
warnings.warn(
71+
"Problem with cv2 import: \n{}\n opencv-python will be added to requirements".format(opencv_import_error)
72+
)
6473
requirements.append('opencv-python')
6574

6675
setup(
@@ -78,5 +87,5 @@ def find_version(*path):
7887
python_requires='>=3.5',
7988
install_requires=requirements,
8089
tests_require=[read("requirements-test.in")],
81-
cmdclass={'test': PyTest}
90+
cmdclass={'test': PyTest, 'install_core': CoreInstall}
8291
)

0 commit comments

Comments
 (0)
Please sign in to comment.