forked from LLNL/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
119 lines (98 loc) · 3.8 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
###############################################################################
# Copyright (c) 2023, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by the Merlin dev team, listed in the CONTRIBUTORS file.
#
# LLNL-CODE-797170
# All rights reserved.
# This file is part of Merlin, Version: 1.12.0.
#
# For details, see https://github.com/LLNL/merlin.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
###############################################################################
import os
from setuptools import find_packages, setup
version = __import__("merlin").VERSION
extras = ["dev"]
def readme():
with open("README.md") as f:
return f.read()
# The reqs code from celery setup.py
def _strip_comments(line: str):
"""Removes comments from a line passed in from _reqs()."""
return line.split("#", 1)[0].strip()
def _pip_requirement(req):
if req.startswith("-r "):
_, path = req.split()
return reqs(*path.split(os.path.sep))
return [req]
def _reqs(*f):
return [
_pip_requirement(r)
for r in (_strip_comments(line) for line in open(os.path.join(os.getcwd(), "requirements", *f)).readlines()) # noqa
if r
]
def reqs(*f):
"""Parse requirement file.
Example:
reqs('default.txt') # requirements/default.txt
reqs('extras', 'redis.txt') # requirements/extras/redis.txt
Returns:
List[str]: list of requirements specified in the file.
"""
trl = [req for subreq in _reqs(*f) for req in subreq]
rl = [r for r in trl if "-e" not in r]
return rl
def install_requires():
"""Get list of requirements required for installation."""
return reqs("release.txt")
def extras_require():
"""Get map of all extra requirements."""
return {x: reqs(x + ".txt") for x in extras}
setup(
name="merlin",
author="Merlin Dev team",
author_email="[email protected]",
version=version,
description="The building blocks of workflows!",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords="machine learning workflow",
url="https://github.com/LLNL/merlin",
license="MIT",
packages=find_packages(exclude=["tests.*", "tests"]),
install_requires=install_requires(),
extras_require=extras_require(),
entry_points={
"console_scripts": [
"merlin=merlin.main:main",
"merlin-templates=merlin.merlin_templates:main",
]
},
include_package_data=True,
zip_safe=False,
)