This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
89 lines (72 loc) · 3 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
import sys
import codecs
import os.path
import re
from setuptools import setup, find_packages
from datarobot_batch_scoring.consts import DEPRECATION_WARNING
extra = {}
def read_requirements_file(file):
fname = os.path.join(os.path.abspath(os.path.dirname(__file__)), file)
with open(fname, 'r') as r:
return r.readlines()
install_requires = read_requirements_file('requirements-base.txt')
# Since futures 3.2 [1], the package enforces to be installed only in Python 2
# environments because it's basically a backport of Python 3's built-in
# package. So in order to support both Python 2 and Python 3 environments, we
# have to skip installation of futures package in case of Python 3.
#
# It might look natural to use environment markers [2] to achieve this goal but
# they are new and were introduced in setuptools in mid of 2017. FWIW,
# setuptools on both Ubuntu Trusty and Ubuntu Xenial do not support them and
# batch scoring script may be installed in pretty outdated envs. So let's do it
# old-fashioned way by adding condition here.
#
# The above is implemented by splitting dependencies into 2 files:
# `requirements-base.txt` - common deps for Py3 and Py2
# `requirements-py27.txt` - for Python 2 only
#
# [1] https://github.com/agronholm/pythonfutures/commit/d0393ad626d25622927bb0ed47d35ddb2f6cd321 # noqa: E501
# [2] https://www.python.org/dev/peps/pep-0508/#environment-markers
if sys.version_info[0] < 3:
install_requires.extend(
read_requirements_file('requirements-py27.txt')
)
extra['entry_points'] = {
'console_scripts': [
'batch_scoring = datarobot_batch_scoring.main:main',
'batch_scoring_sse = datarobot_batch_scoring.main:main_standalone',
'batch_scoring_deployment_aware = datarobot_batch_scoring.main:main_deployment_aware'
]}
extra['install_requires'] = install_requires
this_directory = os.path.abspath(os.path.dirname(__file__))
init_fname = os.path.join(this_directory, 'datarobot_batch_scoring', '__init__.py')
with codecs.open(init_fname, 'r', 'latin1') as fp:
try:
version = re.findall(r"^__version__ = '([^']+)'\r?$",
fp.read(), re.M)[0]
except IndexError:
raise RuntimeError('Unable to determine version.')
readme_fname = os.path.join(this_directory, 'README.rst')
with codecs.open(readme_fname, 'r', 'utf-8') as f:
long_description = f.read()
setup(
name='datarobot_batch_scoring',
version=version,
description=("A script to score CSV files via DataRobot's prediction API"),
long_description=long_description,
author='DataRobot',
author_email='[email protected]',
maintainer='DataRobot',
maintainer_email='[email protected]',
license='BSD',
url='http://www.datarobot.com/',
packages=find_packages(),
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
],
**extra
)
print(DEPRECATION_WARNING)