-
Notifications
You must be signed in to change notification settings - Fork 155
/
setup.py
175 lines (155 loc) · 5.14 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# isort: skip_file
import io
import os
import sys
import numpy
# NOTE: DO NOT change the import order, as sometimes there is a conflict between setuptools and distutils,
# it will cause following error:
# error: each element of 'ext_modules' option must be an Extension instance or 2-tuple
from setuptools import find_packages
from distutils.core import setup
from distutils.extension import Extension
from maro import __version__
compile_flag = "-std=c++11"
if sys.platform == "win32":
compile_flag = "/std:c++14"
# Set environment variable to skip deployment process of MARO
os.environ["SKIP_DEPLOYMENT"] = "TRUE"
# root path to backend
BASE_SRC_PATH = "./maro/backends"
# backend module name
BASE_MODULE_NAME = "maro.backends"
# extensions to be compiled
extensions = []
cython_directives = {"embedsignature": True}
compile_conditions = {}
# CURRENTLY we using environment variables to specified compiling conditions
# TODO: used command line arguments instead
# include dirs for frame and its backend
include_dirs = []
# backend base extensions
extensions.append(
Extension(
f"{BASE_MODULE_NAME}.backend",
sources=[f"{BASE_SRC_PATH}/backend.cpp"],
extra_compile_args=[compile_flag],
),
)
include_dirs.append(numpy.get_include())
extensions.append(
Extension(
f"{BASE_MODULE_NAME}.np_backend",
sources=[f"{BASE_SRC_PATH}/np_backend.cpp"],
include_dirs=include_dirs,
extra_compile_args=[compile_flag],
),
)
# raw implementation
# NOTE: not implemented now
extensions.append(
Extension(
f"{BASE_MODULE_NAME}.raw_backend",
sources=[f"{BASE_SRC_PATH}/raw_backend.cpp"],
include_dirs=include_dirs,
extra_compile_args=[compile_flag],
),
)
# frame
extensions.append(
Extension(
f"{BASE_MODULE_NAME}.frame",
sources=[f"{BASE_SRC_PATH}/frame.cpp"],
include_dirs=include_dirs,
extra_compile_args=[compile_flag],
),
)
# It is not necessary to install these packages when using manylinux action, as we only need numpy to build wheels
# NOTE: install following package will cause build error in current(2023-03-14) manylinux image
if "GITHUB_BUILD_ACTION" in os.environ:
install_requires = []
else:
install_requires = [
# TODO: use a helper function to collect these
"holidays>=0.10.3",
"numpy>=1.19.5",
"pandas>=0.25.3",
"paramiko>=2.9.2",
"ptvsd>=4.3.2",
"python_dateutil>=2.8.1",
"PyYAML>=5.4.1",
"pyzmq>=19.0.2",
"redis>=3.5.3",
"requests>=2.25.1",
"scipy>=1.7.0",
"tabulate>=0.8.5",
"torch>=1.6.0, <1.14.0",
"tornado>=6.1",
]
if sys.version.startswith("3.6"):
install_requires.append("dataclasses>=0.5")
readme = io.open("./maro/README.rst", encoding="utf-8").read()
setup(
name="pymaro",
version=__version__,
description="MARO Python Package",
long_description=readme,
long_description_content_type="text/x-rst",
author="MARO Team",
author_email="[email protected]",
url="https://github.com/microsoft/maro",
project_urls={
"Code": "https://github.com/microsoft/maro",
"Issues": "https://github.com/microsoft/maro/issues",
"Documents": "https://maro.readthedocs.io/en/latest",
},
license="MIT License",
platforms=["Windows", "Linux", "macOS"],
keywords=[
"citi-bike",
"inventory-management",
"operations-research",
"reinforcement-learning",
"resource-optimization",
"simulator",
],
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
python_requires=">=3.7",
setup_requires=[
"numpy<1.20.0",
],
install_requires=install_requires,
entry_points={
"console_scripts": [
"maro=maro.cli.maro:main",
],
},
packages=find_packages(exclude=["tests", "tests.*", "examples", "examples.*"]),
include_package_data=True,
package_data={
"maro.simulator.scenarios.cim": ["topologies/*/*.yml", "meta/*.yml"],
"maro.simulator.scenarios.citi_bike": ["topologies/*/*.yml", "meta/*.yml"],
"maro.simulator.scenarios.vm_scheduling": ["topologies/*/*.yml", "meta/*.yml"],
"maro.cli.k8s": ["lib/*", "lib/*/*", "lib/*/*/*", "lib/*/*/*/*"],
"maro.cli.grass": ["lib/*", "lib/*/*", "lib/*/*/*", "lib/*/*/*/*", "lib/*/*/*/*/*"],
"maro.cli.project_generator/templates": ["*.jinja"],
"maro.cli.utils": ["web_terminal/*"],
},
zip_safe=False,
ext_modules=extensions,
)