-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
149 lines (127 loc) · 4.28 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2023 Maintainers of OarphPy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## NB See notes on `extras_require` and `Optional Dependencies` below.
import os
import sys
import re
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
# Function to parse __version__ in `oarphpy/__init__.py`
def find_version():
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'oarphpy', '__init__.py'), 'r') as fp:
version_file = fp.read()
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
# Decide which pytest we can use; pytest 4.x is last with dual support
setup_requires = ['pytest-runner']
tests_require = ['pytest']
if sys.version_info[0] < 3:
setup_requires = [
'pytest-runner==4.2.0',
# Pin to a variety of old versions because python2 support is
# deteriorating-- new versions break the build
'configparser==3.5.0',
'contextlib2==0.5.4',
'scandir==1.5.0',
'importlib-metadata==0.12',
'atomicwrites==1.0.0',
'attrs==17.4.0',
]
tests_require = ['pytest==4.2.0']
## Optional Dependencies
# OarphPy works in standard python 2 and 3 environments, but we provide extras
# if you have tensorflow, spark, or for the full-race oarphpy/full environment.
# For mor info, see "Dockerized Development Environments" in the root project
# README.md.
HAVE_SYSTEM_SPARK = False
try:
import pyspark
HAVE_SYSTEM_SPARK = True
except ImportError:
HAVE_SYSTEM_SPARK = (
os.environ.get('SPARK_HOME') or
os.path.exists('/opt/spark'))
SPARK_DEPS = [
'findspark==1.3.0', # NB: v1.4 appears broken for Spark 3.0.1
'numpy',
'pandas>=1.1.2',
'cloudpickle>=1.5.0',
]
if not HAVE_SYSTEM_SPARK:
SPARK_DEPS += ['pyspark>=3.0.1']
# Tensorflow support is DEPRECATED!
TF_DEPS = [
'crcmod', # TFRecords + GCloud needs this
] # User must bring their own tensorflow (GPU or CPU)
UTILS = [
# For various
'six',
# For SystemLock
# 'fasteners==0.14.1', TODO clean up util.SystemLock
# For lots of things
'pandas>=1.1.2',
# For ThruputObserver
'humanfriendly',
'tabulate',
'tabulatehelper',
# For misc image utils
'imageio',
# For oarphpy.plotting
'bokeh==3.0.3',
# For misc utils
'cloudpickle>=1.5.0',
]
ALL_DEPS = UTILS + SPARK_DEPS
dist = setup(
name='oarphpy',
version=find_version(),
description='A collection of Python utils with an emphasis on Data Science',
author='Oarph',
author_email='[email protected]',
url='https://github.com/pwais/oarphpy',
license='Apache License 2.0',
packages=find_packages(exclude=['oarphpy_test*']),
long_description="See https://github.com/pwais/oarphpy",
long_description_content_type="text/x-rst",
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries',
'Topic :: Scientific/Engineering',
'Topic :: System :: Distributed Computing',
],
test_suite='oarphpy_test',
setup_requires=setup_requires,
tests_require=tests_require,
extras_require={
'all': ALL_DEPS, # for oarphpy/full environment
'utils': UTILS, # for oarphpy/full environment
'spark': SPARK_DEPS, # for oarphpy/spark environment
'tensorflow': TF_DEPS, # for oarphpy/tensorflow environment
# NB: for vanilla oarphpy/base-py2 and
# oarphpy/base-py3 environments, we simply
# include none of these extras.
},
)