-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathsetup.py
95 lines (80 loc) · 2.93 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
from distutils.core import setup
from typing import List
from setuptools import find_packages
def read_version(filename: str) -> str:
"""Read the version number from a file.
Args:
filename (str): The file to read the version number from.
Returns:
str: The version number.
"""
with open(filename, "r") as v:
major_minor_patch = v.read().strip()
return major_minor_patch
def get_requirements(filename: str) -> List[str]:
"""Get the requirements from a file.
Args:
filename (str): The file to get the requirements from.
Returns:
List[str]: The requirements.
"""
line_strings = [dep.strip() for dep in open(filename, "r").readlines()]
req_strings = []
use_line = False
for line_str in line_strings:
if "dependencies" in line_str:
use_line = True
continue
elif "python" in line_str:
if "python-json-logger" in line_str:
use_line = True
else:
continue
elif "pytorch-cpu" in line_str:
line_str = line_str.replace("pytorch-cpu", "torch")
elif "platforms" in line_str:
use_line = False
if use_line:
req_strings.append(line_str[2:])
return req_strings
setup_dict = dict(
name="facetorch",
version=read_version("./version"),
description="Face analysis PyTorch framework.",
author="Tomas Gajarsky",
author_email="[email protected]",
maintainer="Tomas Gajarsky",
maintainer_email="[email protected]",
url="https://github.com/tomas-gajarsky/facetorch",
download_url="https://pypi.org/project/facetorch/",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Science/Research",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages(exclude=("tests",)),
python_requires=">=3.8",
install_requires=get_requirements("environment.yml"),
tests_require=get_requirements("environment.yml") + ["pytest", "pytest-cov"],
setup_requires=["wheel", "setuptools>=63.4.2"],
zip_safe=False,
license_files=("LICENSE",),
)
def main() -> None:
setup(**setup_dict)
if __name__ == "__main__":
main()