📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
Optim ocrweb setup func
SWHL89d0b621c1ff
diff --git a/.github/workflows/gen_whl_to_pypi_rapidocr_web.yml b/.github/workflows/gen_whl_to_pypi_rapidocr_web.ymlindex 77ee117..3e0b534 100644--- a/.github/workflows/gen_whl_to_pypi_rapidocr_web.yml+++ b/.github/workflows/gen_whl_to_pypi_rapidocr_web.yml@@ -35,7 +35,6 @@ jobs:run: |cd ocrwebpip install -r requirements.txt- pip install wheelpython -m pip install --upgrade pippython setup.py bdist_wheel ${{ github.event.head_commit.message }}diff --git a/ocrweb/requirements.txt b/ocrweb/requirements.txtindex 9b8446c..7b13fb3 100644--- a/ocrweb/requirements.txt+++ b/ocrweb/requirements.txt@@ -2,3 +2,5 @@ PillowrequestsFlask>=2.1.0rapidocr_onnxruntime+get_pypi_latest_version+wheeldiff --git a/ocrweb/setup.py b/ocrweb/setup.pyindex b14c718..8e06aae 100644--- a/ocrweb/setup.py+++ b/ocrweb/setup.py@@ -1,32 +1,11 @@# -*- encoding: utf-8 -*-# @Author: SWHL# @Contact: [email protected]-import re-import subprocessimport sysfrom pathlib import Pathimport setuptools---def get_latest_version(package_name):- output = subprocess.run(['pip', 'index', 'versions', package_name],- capture_output=True)- output = output.stdout.decode('utf-8')- if output:- return extract_version(output)- return None---def version_add_one(version, add_loc=-1):- if not version:- return '0.0.1'-- version_list = version.split('.')- mini_version = str(int(version_list[add_loc]) + 1)- version_list[add_loc] = mini_version- new_version = '.'.join(version_list)- return new_version+from get_pypi_latest_version import GetPyPiLatestVersiondef get_readme():@@ -37,22 +16,16 @@ def get_readme():return readme-def extract_version(message: str) -> str:- pattern = r'\d+\.(?:\d+\.)*\d+'- matched_versions = re.findall(pattern, message)- if matched_versions:- return matched_versions[0]- return ''--MODULE_NAME = 'rapidocr_web'-latest_version = get_latest_version(MODULE_NAME)-VERSION_NUM = version_add_one(latest_version)++obtainer = GetPyPiLatestVersion()+latest_version = obtainer(MODULE_NAME)+VERSION_NUM = obtainer.version_add_one(latest_version)# 优先提取commit message中的语义化版本号,如无,则自动加1if len(sys.argv) > 2:match_str = ' '.join(sys.argv[2:])- matched_versions = extract_version(match_str)+ matched_versions = obtainer.extract_version(match_str)if matched_versions:VERSION_NUM = matched_versionssys.argv = sys.argv[:2]@@ -86,11 +59,8 @@ setuptools.setup('Programming Language :: Python :: 3.9','Programming Language :: Python :: 3.10',],+ python_requires='>=3.6,<=3.10',entry_points={'console_scripts': [f'{MODULE_NAME}={MODULE_NAME}.ocrweb:main'],},- # extras_require={- # 'onnxruntime': ['rapidocr_onnxruntime'],- # 'openvino': ['rapidocr_openvino']- # })