【OCR Issue No.12】Modify the setuptools configuration from SETUP.py into PYPROJECT.toml (#12013)

Modify the setuptools configuration from SETUP.py into PYPROJECT.toml
This commit is contained in:
张春乔 2024-05-24 11:45:15 +08:00 committed by GitHub
parent e73eb76271
commit 3a66efc7bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 78 additions and 66 deletions

View File

@ -33,7 +33,7 @@ jobs:
pip install setuptools
pip install wheel
- name: Build package
run: python setup.py bdist_wheel
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:

1
VERSION_NUMBER Normal file
View File

@ -0,0 +1 @@
2.8.0

View File

@ -12,8 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .paddleocr import *
import importlib.metadata as importlib_metadata
__version__ = paddleocr.VERSION
try:
__version__ = importlib_metadata.version(__package__ or __name__)
except importlib_metadata.PackageNotFoundError:
__version__ = "0.0.0"
__all__ = [
"PaddleOCR",
"PPStructure",

View File

@ -78,7 +78,6 @@ __all__ = [
]
SUPPORT_DET_MODEL = ["DB"]
VERSION = "2.8.0"
SUPPORT_REC_MODEL = ["CRNN", "SVTR_LCNet"]
BASE_DIR = os.path.expanduser("~/.paddleocr/")

70
pyproject.toml Normal file
View File

@ -0,0 +1,70 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "paddleocr"
# After each version release, the version number needs to be incremented
dynamic = ["version"]
description = "Awesome OCR toolkits based on PaddlePaddle(8.6M ultra-lightweight pre-trained model, support training and deployment among server, mobile, embedded and IoT devices)"
authors = [
{name = "PaddlePaddle", email = "Paddle-better@baidu.com"},
]
maintainers = [
{name = "PaddlePaddle", email = "Paddle-better@baidu.com"},
]
readme = "README.md"
requires-python = ">=3.8"
keywords = [
"ocr",
"textdetection",
"textrecognition",
"paddleocr",
"crnn",
"east",
"star-net",
"rosetta",
"ocrlite",
"db",
"chineseocr",
"chinesetextdetection",
"chinesetextrecognition",
]
license = {text = "Apache License 2.0"}
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Natural Language :: Chinese (Simplified)",
"Programming Language :: Python :: 3",
"Topic :: Utilities",
]
dependencies = [
"shapely",
"scikit-image",
"imgaug",
"pyclipper",
"lmdb",
"tqdm",
"numpy",
"rapidfuzz",
"opencv-python<=4.6.0.66",
"opencv-contrib-python<=4.6.0.66",
"cython",
"Pillow>=10.0.0",
"pyyaml",
"python-docx",
"beautifulsoup4",
"fonttools>=4.24.0",
"fire>=0.3.0",
]
[project.scripts]
paddleocr = "paddleocr.paddleocr:main"
[tool.setuptools]
packages = ["paddleocr"]
package-dir = { "paddleocr" = "" }
include-package-data = true
[tool.setuptools.dynamic]
version = {file = "VERSION_NUMBER"}

View File

@ -13,68 +13,6 @@
# limitations under the License.
from setuptools import setup
from io import open
import subprocess
# get version by matchiing, so will not need to setup complex env in github aciton
p = subprocess.Popen(
"grep ^VERSION ./paddleocr.py | awk '{print $3}' | tr -d '\"'",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
)
raw_VERSION, _ = p.communicate()
VERSION = raw_VERSION.decode().strip()
def load_requirements(file_list=None):
if file_list is None:
file_list = ["requirements.txt"]
if isinstance(file_list, str):
file_list = [file_list]
requirements = []
for file in file_list:
with open(file, encoding="utf-8-sig") as f:
requirements.extend(f.readlines())
return requirements
def readme():
with open("doc/doc_en/whl_en.md", encoding="utf-8-sig") as f:
README = f.read()
return README
setup(
name="paddleocr",
packages=["paddleocr"],
package_dir={"paddleocr": ""},
include_package_data=True,
entry_points={"console_scripts": ["paddleocr= paddleocr.paddleocr:main"]},
version=VERSION,
install_requires=load_requirements(
["requirements.txt", "ppstructure/recovery/requirements.txt"]
),
license="Apache License 2.0",
description="Awesome OCR toolkits based on PaddlePaddle(8.6M ultra-lightweight pre-trained model, support training and deployment among server, mobile, embedded and IoT devices)",
long_description=readme(),
long_description_content_type="text/markdown",
url="https://github.com/PaddlePaddle/PaddleOCR",
download_url="https://github.com/PaddlePaddle/PaddleOCR.git",
keywords=[
"ocr textdetection textrecognition paddleocr crnn east star-net rosetta ocrlite db chineseocr chinesetextdetection chinesetextrecognition"
],
classifiers=[
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Natural Language :: Chinese (Simplified)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Utilities",
],
)
setup()