-
Notifications
You must be signed in to change notification settings - Fork 26
/
setup.py
120 lines (105 loc) · 3.59 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
import importlib.metadata
import importlib.util
import re
from pathlib import Path
from setuptools import setup, find_packages
_here = Path(__file__).resolve().parent
name = "dex_retargeting"
# Reference: https://github.com/kevinzakka/mjc_viewer/blob/main/setup.py
with open(_here / name / "__init__.py") as f:
meta_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
if meta_match:
version = meta_match.group(1)
else:
raise RuntimeError("Unable to find __version__ string.")
core_requirements = [
"numpy>=1.21.0",
"pytransform3d>=3.5.0",
"pin>=2.7.0",
"nlopt>=2.6.1",
"trimesh>=4.4.0",
"anytree>=2.12.0",
"pyyaml>=6.0.0",
"lxml>=5.2.2",
]
# Check whether you have torch installed
torch_info = importlib.util.find_spec("torch")
if torch_info is not None:
version = importlib.metadata.version("torch")
major_version = version.split(".")[0]
if int(major_version) >= 2:
print(f"A valid torch with version {version}: has been already installed, skip it.")
else:
raise RuntimeError(
f"dex-retargeting requires a torch version of 2.0.0 or higher. Currently, version {version} is installed.\n"
"Please uninstall the current torch or install torch >= 2.0.0, then reinstall this package."
)
else:
print(
"\033[33m",
"No pre-installed torch detected. A GPU-only version will be installed.\n"
"Note that dex-retargeting is compatible with both CPU and GPU versions of torch, as it only requires the CPU features.\n"
"To save time and space, you can also install a torch cpu version and reinstall this package.\n",
"\033[39m",
)
core_requirements.append("torch")
dev_requirements = [
"pytest",
"black",
"isort",
"pytest-xdist",
"pyright",
"ruff",
"mypy",
]
example_requirements = ["tyro", "tqdm", "opencv-python", "mediapipe", "sapien==3.0.0b0", "loguru"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
def setup_package():
# Meta information of the project
author = "Yuzhe Qin"
author_email = "y1qin@ucsd.edu"
description = "Hand pose retargeting for dexterous robot hand."
url = "https://github.com/dexsuite/dex-retargeting"
with open(_here / "README.md", "r") as file:
readme = file.read()
# Package data
packages = find_packages(".")
print(f"Packages: {packages}")
setup(
name=name,
version=version,
author=author,
author_email=author_email,
maintainer=author,
maintainer_email=author_email,
description=description,
long_description=readme,
long_description_content_type="text/markdown",
url=url,
license="MIT",
license_files=("LICENSE",),
packages=packages,
python_requires=">=3.7,<3.13",
zip_safe=True,
include_package_data=True,
package_data={"dex_retargeting": ["configs/**"]},
install_requires=core_requirements,
extras_require={
"dev": dev_requirements,
"example": example_requirements,
},
classifiers=classifiers,
)
setup_package()