forked from microsoft/TaskWeaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
87 lines (73 loc) · 2.44 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
import os
import re
import setuptools
from scripts.get_package_version import get_package_version
def update_version_file(version: str):
# Extract the version from the init file.
VERSIONFILE = "taskweaver/__init__.py"
with open(VERSIONFILE, "rt") as f:
raw_content = f.read()
content = re.sub(r"__version__ = [\"'][^']*[\"']", f'__version__ = "{version}"', raw_content)
with open(VERSIONFILE, "wt") as f:
f.write(content)
def revert():
with open(VERSIONFILE, "wt") as f:
f.write(raw_content)
return revert
version_str = get_package_version()
revert_version_file = update_version_file(version_str)
# Configurations
with open("README.md", "r") as fh:
long_description = fh.read()
cur_dir = os.path.dirname(
os.path.abspath(
__file__,
),
)
required_packages = []
with open(os.path.join(cur_dir, "requirements.txt"), "r") as f:
for line in f:
if line.startswith("#"):
continue
else:
package = line.strip()
if "whl" in package:
continue
required_packages.append(package)
# print(required_packages)
packages = [
*setuptools.find_packages(),
]
try:
setuptools.setup(
install_requires=required_packages, # Dependencies
extras_require={},
# Minimum Python version
python_requires=">=3.10",
name="taskweaver", # Package name
version=version_str, # Version
author="Microsoft Taskweaver", # Author name
author_email="taskweaver@microsoft.com", # Author mail
description="Python package taskweaver", # Short package description
# Long package description
long_description=long_description,
long_description_content_type="text/markdown",
# Searches throughout all dirs for files to include
packages=packages,
# Must be true to include files depicted in MANIFEST.in
# include_package_data=True,
license_files=["LICENSE"], # License file
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
package_data={
"taskweaver.planner": ["*"], # prompt
"taskweaver.code_interpreter.code_generator": ["*"], # prompt
},
entry_points={
"console_scripts": ["taskweaver=taskweaver.__main__:main"],
},
)
finally:
revert_version_file()