-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
setup.py
89 lines (76 loc) · 3.08 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
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
import sys
from pathlib import Path
from typing import List
import setuptools
from get_pypi_latest_version import GetPyPiLatestVersion
def read_txt(txt_path: str) -> List:
if not isinstance(txt_path, str):
txt_path = str(txt_path)
with open(txt_path, "r", encoding="utf-8") as f:
data = list(map(lambda x: x.rstrip("\n"), f))
return data
def get_readme() -> str:
root_dir = Path(__file__).resolve().parent
readme_path = str(root_dir / "docs" / "doc_whl.md")
with open(readme_path, "r", encoding="utf-8") as f:
readme = f.read()
return readme
MODULE_NAME = "label_convert"
obtainer = GetPyPiLatestVersion()
try:
latest_version = obtainer(MODULE_NAME)
except ValueError:
latest_version = "0.0.1"
VERSION_NUM = obtainer.version_add_one(latest_version)
# 优先提取commit message中的语义化版本号,如无,则自动加1
if len(sys.argv) > 2:
match_str = " ".join(sys.argv[2:])
matched_versions = obtainer.extract_version(match_str)
if matched_versions:
VERSION_NUM = matched_versions
sys.argv = sys.argv[:2]
project_urls = {"Documentation": "https://rapidai.github.io/LabelConvert/docs"}
setuptools.setup(
name=MODULE_NAME,
version=VERSION_NUM,
platforms="Any",
description="A tool for object detection and image segmentation dataset format conversion. Supports conversion between labelme tool annotated data, labelImg tool annotated data, YOLO, PubLayNet and COCO data set formats.",
long_description=get_readme(),
long_description_content_type="text/markdown",
author="SWHL",
author_email="[email protected]",
url="https://github.com/RapidAI/LabelConvert",
project_urls=project_urls,
license="Apache-2.0",
include_package_data=True,
install_requires=read_txt("requirements.txt"),
packages=[MODULE_NAME],
package_data={"": ["*.yaml"]},
keywords=["convert,coco,labelme,labelImg,yolov5,yolox,yolov6,yolov8"],
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
python_requires=">=3.6,<3.12",
entry_points={
"console_scripts": [
f"coco_to_labelImg={MODULE_NAME}.coco_to_labelImg:main",
f"vis_coco={MODULE_NAME}.vis_coco:main",
f"darknet_to_coco={MODULE_NAME}.darknet_to_coco:main",
f"labelImg_to_yolov5={MODULE_NAME}.labelImg_to_yolov5:main",
f"yolov5_to_coco={MODULE_NAME}.yolov5_to_coco:main",
f"yolov5_yaml_to_coco={MODULE_NAME}.yolov5_yaml_to_coco:main",
f"labelImg_to_publaynet={MODULE_NAME}.labelImg_to_publaynet:main",
f"labelme_to_coco={MODULE_NAME}.labelme_to_coco:main",
f"yolov5_to_yolov8={MODULE_NAME}.yolov5_to_yolov8:main",
f"yolov8_to_yolov5={MODULE_NAME}.yolov8_to_yolov5:main",
],
},
)