-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
123 lines (109 loc) · 3.36 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
# Copyright 2017-2023 Lawrence Livermore National Security, LLC and other
# Hatchet Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
from setuptools import setup
from setuptools import Extension
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
# Get the version in a safe way which does not refrence hatchet `__init__` file
# per python docs: https://packaging.python.org/guides/single-sourcing-package-version/
version = {}
with open("./hatchet/version.py") as fp:
exec(fp.read(), version)
cmd_class = {}
ext_modules = []
should_cythonize = False
mod_import_path = "hatchet.cython_modules.libs"
mod_file_path = "hatchet/cython_modules"
mod_names = [
"reader_modules",
"graphframe_modules",
]
for mname in mod_names:
c_file = path.join(mod_file_path, "{}.c".format(mname))
pyx_file = path.join(mod_file_path, "{}.pyx".format(mname))
if not path.isfile(pyx_file):
raise FileNotFoundError(
"Requested Cython extension not found: {}".format(pyx_file)
)
if path.isfile(c_file):
should_cythonize = False
ext_modules.append(
Extension(
"{}.{}".format(mod_import_path, mname),
[c_file],
)
)
else:
should_cythonize = True
ext_modules.append(
Extension(
"{}.{}".format(mod_import_path, mname),
[pyx_file],
)
)
if should_cythonize:
from Cython.Build import cythonize, build_ext
ext_modules = cythonize(ext_modules)
cmd_class.update({"build_ext": build_ext})
ext_modules = [
Extension(
"hatchet.cython_modules.libs.reader_modules",
["hatchet/cython_modules/reader_modules.pyx"],
),
Extension(
"hatchet.cython_modules.libs.graphframe_modules",
["hatchet/cython_modules/graphframe_modules.pyx"],
),
]
setup(
name="llnl-hatchet",
version=version["__version__"],
license="MIT",
description="A Python library for analyzing hierarchical performance data",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/llnl/hatchet",
project_urls={
"Source Code": "https://github.com/llnl/hatchet",
"Documentation": "https://llnl-hatchet.readthedocs.io/en/latest/",
},
author="Stephanie Brink",
author_email="[email protected]",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
],
keywords="",
python_requires=">=3.5",
packages=[
"hatchet",
"hatchet.readers",
"hatchet.writers",
"hatchet.query",
"hatchet.vis",
"hatchet.util",
"hatchet.external",
"hatchet.tests",
"hatchet.cython_modules.libs",
],
include_package_data=True,
install_requires=[
"pydot",
"PyYAML",
"matplotlib",
"numpy < 2.0.0",
"pandas",
"textX < 3.0.0; python_version < '3.6'",
"textX >= 3.0.0; python_version >= '3.6'",
"multiprocess",
"caliper-reader",
],
ext_modules=ext_modules,
cmdclass=cmd_class,
)