-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsetup.py
More file actions
92 lines (80 loc) · 2.78 KB
/
setup.py
File metadata and controls
92 lines (80 loc) · 2.78 KB
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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: Hui
# @Desc: { pypi打包模块 }
# @Date: 2023/9/04 19:59
import operator
from functools import reduce
from setuptools import find_packages, setup
class PKGManager:
name = "huidevkit"
version = "0.6.2"
author = "hui"
author_email = "huidbk@163.com"
@classmethod
def get_pkg_desc(cls):
"""获取包描述"""
with open("README.md", "r") as f:
long_description = f.read()
return long_description
@classmethod
def get_install_requires(cls):
"""获取必须安装依赖"""
requires = [
"loguru>=0.7.0,<0.8",
"pydantic>=2.1.1,<3",
"asgiref==3.8.1",
"nest_asyncio==1.6.0",
"tqdm==4.66.4",
"python-dateutil==2.8.2",
"requests>=2.31.0",
"aiohttp>=3.9.5",
"cacheout==0.14.1",
"aiofiles==24.1.0",
"python-jose==3.3.0",
"pillow==11.1.0",
]
return requires
@classmethod
def get_extras_require(cls):
"""
可选的依赖
"""
extras_require = {
"db-orm": ["sqlalchemy[asyncio]==2.0.20", "aiomysql==0.2.0"],
"db-redis": ["redis>=4.5.4"],
"cache-proxy": ["redis>=4.5.4", "python-memcached==1.62", "cacheout==0.14.1"],
"minio": ["minio==7.1.17"],
"excel-tools": ["pandas==2.0.3", "openpyxl==3.0.10"],
}
extras_require["all"] = list(set(reduce(operator.add, [cls.get_install_requires(), *extras_require.values()])))
extras_require["test"] = ["pytest==7.3.1", "pytest-mock==3.14.0", "pytest-asyncio==0.23.8"]
return extras_require
def main():
setup(
name=PKGManager.name,
author=PKGManager.author,
author_email=PKGManager.author_email,
version=PKGManager.version,
packages=find_packages(),
url="https://github.com/HuiDBK/py-tools",
license="Apache",
description="Practical Python development tools",
long_description=PKGManager.get_pkg_desc(),
long_description_content_type="text/markdown",
install_requires=PKGManager.get_install_requires(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
extras_require=PKGManager.get_extras_require(),
python_requires=">=3.9",
entry_points={"console_scripts": ["py_tools = py_tools.utils.project_templates:make_project"]},
include_package_data=True,
)
if __name__ == "__main__":
# python3 setup.py sdist bdist_wheel
# twine upload --repository testpypi dist/*
# twine upload dist/*
main()