Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to install opencv-python-headless instead opencv-python #62

Merged
merged 3 commits into from
Dec 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: MIT

import os
import os.path as osp
import re
import setuptools
Expand All @@ -27,6 +28,26 @@ def find_version(file_path=None):
version = version_text[match.start(1) : match.end(1)]
return version

def get_requirements():
requirements = [
'attrs>=19.3.0',
'defusedxml',
'GitPython',
'lxml',
'matplotlib',
'numpy>=1.17.3',
'Pillow',
'pycocotools',
'PyYAML',
'scikit-image',
'tensorboardX',
]
if os.getenv('HEADLESS') == '1':
Copy link
Contributor

@zhiltsov-max zhiltsov-max Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it DATUMARO_ or DM_ HEADLESS to avoid unexpected overlaps. Also, I think it's better to use strtobool with .lower().

requirements.append('opencv-python-headless')
else:
requirements.append('opencv-python')

return requirements

with open('README.md', 'r') as fh:
long_description = fh.read()
Expand All @@ -51,20 +72,7 @@ def find_version(file_path=None):
"Operating System :: OS Independent",
],
python_requires='>=3.5',
install_requires=[
'attrs>=19.3.0',
'defusedxml',
'GitPython',
'lxml',
'matplotlib',
'numpy>=1.17.3',
'opencv-python',
'Pillow',
'pycocotools',
'PyYAML',
'scikit-image',
'tensorboardX',
],
install_requires=get_requirements(),
extras_require={
'tf': ['tensorflow'],
'tf-gpu': ['tensorflow-gpu'],
Expand Down