Skip to content

Commit

Permalink
ci(rapidocr_api): Optim auto package logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Jul 11, 2024
1 parent f5f2de2 commit 7238dc1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/gen_whl_to_pypi_rapidocr_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ jobs:
pip install get_pypi_latest_version wheel
python -m pip install --upgrade pip
python setup.py bdist_wheel ${{ github.event.head_commit.message }}
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/[email protected]
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# packages_dir: ocrweb/dist/
python setup.py bdist_wheel "${{ github.event.head_commit.message }}"
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
Expand Down
57 changes: 31 additions & 26 deletions api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

def get_readme():
root_dir = Path(__file__).resolve().parent.parent
readme_path = str(root_dir / 'docs' / 'doc_whl_rapidocr_api.md')
with open(readme_path, 'r', encoding='utf-8') as f:
readme_path = str(root_dir / "docs" / "doc_whl_rapidocr_api.md")
with open(readme_path, "r", encoding="utf-8") as f:
readme = f.read()
return readme


MODULE_NAME = 'rapidocr_api'
MODULE_NAME = "rapidocr_api"

obtainer = GetPyPiLatestVersion()
try:
latest_version = obtainer(MODULE_NAME)
except ValueError:
latest_version = '0.0.0'
latest_version = "0.0.0"
VERSION_NUM = obtainer.version_add_one(latest_version)

if len(sys.argv) > 2:
match_str = ' '.join(sys.argv[2:])
match_str = " ".join(sys.argv[2:])
matched_versions = obtainer.extract_version(match_str)
if matched_versions:
VERSION_NUM = matched_versions
Expand All @@ -35,35 +35,40 @@ def get_readme():
setuptools.setup(
name=MODULE_NAME,
version=VERSION_NUM,
platforms='Any',
description='A cross platform OCR API Library based on OnnxRuntime.',
platforms="Any",
description="A cross platform OCR API Library based on OnnxRuntime.",
long_description=get_readme(),
long_description_content_type='text/markdown',
author='SWHL',
author_email='[email protected]',
url='https://github.com/RapidAI/RapidOCR',
download_url='https://github.com/RapidAI/RapidOCR.git',
license='Apache-2.0',
long_description_content_type="text/markdown",
author="SWHL",
author_email="[email protected]",
url="https://github.com/RapidAI/RapidOCR",
download_url="https://github.com/RapidAI/RapidOCR.git",
license="Apache-2.0",
include_package_data=True,
install_requires=['requests', 'rapidocr_onnxruntime',
'fastapi', 'uvicorn[standard]'],
install_requires=[
"requests",
"rapidocr_onnxruntime",
"fastapi",
"uvicorn[standard]",
],
packages=[MODULE_NAME],
package_data={'': ['*.ico', '*.css', '*.js', '*.html']},
package_data={"": ["*.ico", "*.css", "*.js", "*.html"]},
keywords=[
'ocr,text_detection,text_recognition,db,onnxruntime,paddleocr,openvino,rapidocr'
"ocr,text_detection,text_recognition,db,onnxruntime,paddleocr,openvino,rapidocr"
],
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',
"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",
"Programming Language :: Python :: 3.12",
],
python_requires='>=3.6,<3.12',
python_requires=">=3.6,<3.13",
entry_points={
'console_scripts': [
f'{MODULE_NAME}={MODULE_NAME}.api:main',
"console_scripts": [
f"{MODULE_NAME}={MODULE_NAME}.api:main",
],
},
)

0 comments on commit 7238dc1

Please sign in to comment.