From 8794a88ba9f6fe5df823372c63b98c95abfdea1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philemon=20Sch=C3=B6pf?= Date: Wed, 26 Apr 2023 16:59:52 +0200 Subject: [PATCH 1/4] move to pyproject.toml --- pyproject.toml | 40 +++++++++++++++++++++++++++++++++++++++- setup.py | 27 --------------------------- 2 files changed, 39 insertions(+), 28 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index f5da625..496250d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,40 @@ +[project] +name = "ocr_wrapper" +version = "0.0.24" +license.file = "LICENSE.md" +authors = [{ name = "DeepOpinion", email = "hello@deepopinion.ai" }] +urls.repository = "https://github.com/deepopinion/ocr_wrapper" + +dependencies = [ + "Pillow", + "Shapely>=2.0,<3.0", + "pdf2image", + "rtree", + "opencv-python-headless", + "torch", + "torchvision", + "numpy", +] + +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] + +[project.optional-dependencies] +azure = ["azure-cognitiveservices-vision-computervision"] + +google = ["google-cloud-vision"] +googleazure = ["ocr_wrapper[google,azure]", "google-cloud-documentai"] +aws = ["boto3"] +easy = ["easyocr"] +paddle = ["paddleocr>=2.0.1"] + +dev = ["black~=24.4", "hypothesis", "pytest"] +all = ["ocr_wrapper[azure,google,googleazure,aws,easy,paddle]"] + [tool.black] -line-length = 119 \ No newline at end of file +line-length = 119 + +[tool.setuptools] +py-modules = ["ocr_wrapper"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 5e454f4..0000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="ocr_wrapper", - version="0.0.24", - packages=find_packages(), - include_package_data=True, - license="MIT", - url="https://github.com/deepopinion/ocr_wrapper", - author="DeepOpinion", - author_email="hello@deepopinion.ai", - classifiers=[ - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - ], - install_requires=[ - "Pillow", - "Shapely>=2.0,<3.0", - "pdf2image", - "rtree", - "opencv-python-headless", - "torch", - "torchvision", - "numpy", - ], - zip_safe=False, -) From 5feb11762fb19fa71c45fdd500833e0750ba8723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philemon=20Sch=C3=B6pf?= Date: Mon, 22 Apr 2024 21:09:14 +0200 Subject: [PATCH 2/4] exclude broken grpcio versions --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 496250d..f441d3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,10 @@ classifiers = [ [project.optional-dependencies] azure = ["azure-cognitiveservices-vision-computervision"] -google = ["google-cloud-vision"] +google = [ + "google-cloud-vision", + "grpcio!=1.59.*,!=1.60.*,!=1.61.*,!=1.62.0,!=1.62.1", # https://github.com/deepopinion/ocr_wrapper/issues/17 +] googleazure = ["ocr_wrapper[google,azure]", "google-cloud-documentai"] aws = ["boto3"] easy = ["easyocr"] From 64347ce580598761d3a27f838d5af957dfe811c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philemon=20Sch=C3=B6pf?= Date: Tue, 23 Apr 2024 18:57:14 +0200 Subject: [PATCH 3/4] fix packaging --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f441d3c..bdc46a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ [project.optional-dependencies] azure = ["azure-cognitiveservices-vision-computervision"] - google = [ "google-cloud-vision", "grpcio!=1.59.*,!=1.60.*,!=1.61.*,!=1.62.0,!=1.62.1", # https://github.com/deepopinion/ocr_wrapper/issues/17 @@ -36,8 +35,11 @@ paddle = ["paddleocr>=2.0.1"] dev = ["black~=24.4", "hypothesis", "pytest"] all = ["ocr_wrapper[azure,google,googleazure,aws,easy,paddle]"] +[build-system] +requires = ["setuptools>=67.1.0", "wheel>=0.38.4"] + [tool.black] line-length = 119 [tool.setuptools] -py-modules = ["ocr_wrapper"] +packages = ["ocr_wrapper"] From 4d25000427c69fe5b77223a08cf911735d238112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philemon=20Sch=C3=B6pf?= Date: Tue, 23 Apr 2024 19:06:53 +0200 Subject: [PATCH 4/4] build script to use pyproject --- devops/build.sh | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/devops/build.sh b/devops/build.sh index d400e99..8311373 100755 --- a/devops/build.sh +++ b/devops/build.sh @@ -1,4 +1,4 @@ #!/bin/bash echo "Build package" -python setup.py bdist_wheel +python -m build diff --git a/pyproject.toml b/pyproject.toml index bdc46a7..5a6bbdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,3 +43,4 @@ line-length = 119 [tool.setuptools] packages = ["ocr_wrapper"] +package-data = { ocr_wrapper = ["*.json"]}