-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
42 lines (34 loc) · 1.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
import os
from pip._internal.req import parse_requirements
from setuptools import setup, find_namespace_packages
# TODO: find from extras maybe
HOST_MLIR_PYTHON_PACKAGE_PREFIX = os.environ.get(
"HOST_MLIR_PYTHON_PACKAGE_PREFIX", "mlir"
)
PACKAGE_NAME = f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX.replace('.', '-').replace('_', '-')}-python-extras"
def load_requirements(fname):
reqs = parse_requirements(fname, session="hack")
return [str(ir.requirement) for ir in reqs]
packages = [
f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras.{p}"
for p in find_namespace_packages(where="mlir/extras")
] + [f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras"]
setup(
name=PACKAGE_NAME,
version="0.0.7",
description="The missing pieces (as far as boilerplate reduction goes) of the upstream MLIR python bindings.",
license="LICENSE",
install_requires=load_requirements("requirements.txt"),
extras_require={
"test": ["pytest", "mlir-native-tools", "astpretty"],
"torch-mlir": ["torch-mlir-core"],
"jax": ["jax[cpu]"],
"mlir": ["mlir-python-bindings"],
},
python_requires=">=3.8",
packages=packages,
# lhs is package namespace, rhs is path (relative to this setup.py)
package_dir={
f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras": "mlir/extras",
},
)