From 62314c453ce7cbe0c66061b88a0367d4163124a2 Mon Sep 17 00:00:00 2001 From: kba Date: Tue, 27 Aug 2024 15:04:57 +0200 Subject: [PATCH 1/3] fully transition to pyproject --- pyproject.toml | 3 +-- setup.py | 28 ++-------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d6f16b3..8f9f175 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ requires = ["setuptools>=61.0", "wheel", "setuptools-ocrd"] [project] name = "eynollah" -version = "0.3.1" authors = [ {name = "Vahid Rezanezhad"}, {name = "Staatsbibliothek zu Berlin - Preußischer Kulturbesitz"}, @@ -14,7 +13,7 @@ license.file = "LICENSE" requires-python = ">=3.8" keywords = ["document layout analysis", "image segmentation"] -dynamic = ["dependencies"] +dynamic = ["dependencies", "version"] classifiers = [ "Development Status :: 4 - Beta", diff --git a/setup.py b/setup.py index af8a321..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,3 @@ -from setuptools import setup, find_namespace_packages -from json import load +from setuptools import setup -install_requires = open('requirements.txt').read().split('\n') -with open('ocrd-tool.json', 'r', encoding='utf-8') as f: - version = load(f)['version'] - -setup( - name='eynollah', - version=version, - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - author='Vahid Rezanezhad', - url='https://github.com/qurator-spk/eynollah', - license='Apache License 2.0', - packages=find_namespace_packages(include=['qurator']), - install_requires=install_requires, - package_data={ - '': ['*.json'] - }, - entry_points={ - 'console_scripts': [ - 'eynollah=qurator.eynollah.cli:main', - 'ocrd-eynollah-segment=qurator.eynollah.ocrd_cli:main', - ] - }, -) +setup() From 9367f86483329f7771d2d63cb063107d258f5412 Mon Sep 17 00:00:00 2001 From: kba Date: Thu, 29 Aug 2024 17:06:39 +0200 Subject: [PATCH 2/3] remove setup.py stub completely --- setup.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From 84b844203d7a1cb27fccefd19dee2869b0abe3b2 Mon Sep 17 00:00:00 2001 From: kba Date: Thu, 29 Aug 2024 17:11:29 +0200 Subject: [PATCH 3/3] switch from qurator namespace to src-layout --- ocrd-tool.json | 2 +- pyproject.toml | 6 +++--- qurator/.gitkeep | 0 {qurator => src}/eynollah/__init__.py | 0 {qurator => src}/eynollah/cli.py | 2 +- {qurator => src}/eynollah/eynollah.py | 0 {qurator => src}/eynollah/ocrd-tool.json | 0 {qurator => src}/eynollah/ocrd_cli.py | 0 {qurator => src}/eynollah/plot.py | 0 {qurator => src}/eynollah/processor.py | 0 {qurator => src}/eynollah/utils/__init__.py | 0 {qurator => src}/eynollah/utils/contour.py | 0 {qurator => src}/eynollah/utils/counter.py | 0 {qurator => src}/eynollah/utils/drop_capitals.py | 0 {qurator => src}/eynollah/utils/is_nan.py | 0 {qurator => src}/eynollah/utils/marginals.py | 0 {qurator => src}/eynollah/utils/pil_cv2.py | 0 {qurator => src}/eynollah/utils/resize.py | 0 {qurator => src}/eynollah/utils/rotate.py | 0 {qurator => src}/eynollah/utils/separate_lines.py | 0 {qurator => src}/eynollah/utils/xml.py | 0 {qurator => src}/eynollah/writer.py | 0 tests/test_counter.py | 2 +- tests/test_dpi.py | 2 +- tests/test_run.py | 2 +- tests/test_smoke.py | 12 ++++++------ tests/test_xml.py | 2 +- 27 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 qurator/.gitkeep rename {qurator => src}/eynollah/__init__.py (100%) rename {qurator => src}/eynollah/cli.py (99%) rename {qurator => src}/eynollah/eynollah.py (100%) rename {qurator => src}/eynollah/ocrd-tool.json (100%) rename {qurator => src}/eynollah/ocrd_cli.py (100%) rename {qurator => src}/eynollah/plot.py (100%) rename {qurator => src}/eynollah/processor.py (100%) rename {qurator => src}/eynollah/utils/__init__.py (100%) rename {qurator => src}/eynollah/utils/contour.py (100%) rename {qurator => src}/eynollah/utils/counter.py (100%) rename {qurator => src}/eynollah/utils/drop_capitals.py (100%) rename {qurator => src}/eynollah/utils/is_nan.py (100%) rename {qurator => src}/eynollah/utils/marginals.py (100%) rename {qurator => src}/eynollah/utils/pil_cv2.py (100%) rename {qurator => src}/eynollah/utils/resize.py (100%) rename {qurator => src}/eynollah/utils/rotate.py (100%) rename {qurator => src}/eynollah/utils/separate_lines.py (100%) rename {qurator => src}/eynollah/utils/xml.py (100%) rename {qurator => src}/eynollah/writer.py (100%) diff --git a/ocrd-tool.json b/ocrd-tool.json index 5c48493..711a192 120000 --- a/ocrd-tool.json +++ b/ocrd-tool.json @@ -1 +1 @@ -qurator/eynollah/ocrd-tool.json \ No newline at end of file +src/eynollah/ocrd-tool.json \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8f9f175..67a420d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] [project.scripts] -eynollah = "qurator.eynollah.cli:main" -ocrd-eynollah-segment = "qurator.eynollah.ocrd_cli:main" +eynollah = "eynollah.cli:main" +ocrd-eynollah-segment = "eynollah.ocrd_cli:main" [project.urls] Homepage = "https://github.com/qurator-spk/eynollah" @@ -37,7 +37,7 @@ Repository = "https://github.com/qurator-spk/eynollah.git" dependencies = {file = ["requirements.txt"]} [tool.setuptools.packages.find] -where = ["qurator"] +where = ["src"] [tool.setuptools.package-data] "*" = ["*.json", '*.yml', '*.xml', '*.xsd'] diff --git a/qurator/.gitkeep b/qurator/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/qurator/eynollah/__init__.py b/src/eynollah/__init__.py similarity index 100% rename from qurator/eynollah/__init__.py rename to src/eynollah/__init__.py diff --git a/qurator/eynollah/cli.py b/src/eynollah/cli.py similarity index 99% rename from qurator/eynollah/cli.py rename to src/eynollah/cli.py index 822db18..d61928f 100644 --- a/qurator/eynollah/cli.py +++ b/src/eynollah/cli.py @@ -1,7 +1,7 @@ import sys import click from ocrd_utils import initLogging, setOverrideLogLevel -from qurator.eynollah.eynollah import Eynollah +from eynollah.eynollah import Eynollah @click.command() diff --git a/qurator/eynollah/eynollah.py b/src/eynollah/eynollah.py similarity index 100% rename from qurator/eynollah/eynollah.py rename to src/eynollah/eynollah.py diff --git a/qurator/eynollah/ocrd-tool.json b/src/eynollah/ocrd-tool.json similarity index 100% rename from qurator/eynollah/ocrd-tool.json rename to src/eynollah/ocrd-tool.json diff --git a/qurator/eynollah/ocrd_cli.py b/src/eynollah/ocrd_cli.py similarity index 100% rename from qurator/eynollah/ocrd_cli.py rename to src/eynollah/ocrd_cli.py diff --git a/qurator/eynollah/plot.py b/src/eynollah/plot.py similarity index 100% rename from qurator/eynollah/plot.py rename to src/eynollah/plot.py diff --git a/qurator/eynollah/processor.py b/src/eynollah/processor.py similarity index 100% rename from qurator/eynollah/processor.py rename to src/eynollah/processor.py diff --git a/qurator/eynollah/utils/__init__.py b/src/eynollah/utils/__init__.py similarity index 100% rename from qurator/eynollah/utils/__init__.py rename to src/eynollah/utils/__init__.py diff --git a/qurator/eynollah/utils/contour.py b/src/eynollah/utils/contour.py similarity index 100% rename from qurator/eynollah/utils/contour.py rename to src/eynollah/utils/contour.py diff --git a/qurator/eynollah/utils/counter.py b/src/eynollah/utils/counter.py similarity index 100% rename from qurator/eynollah/utils/counter.py rename to src/eynollah/utils/counter.py diff --git a/qurator/eynollah/utils/drop_capitals.py b/src/eynollah/utils/drop_capitals.py similarity index 100% rename from qurator/eynollah/utils/drop_capitals.py rename to src/eynollah/utils/drop_capitals.py diff --git a/qurator/eynollah/utils/is_nan.py b/src/eynollah/utils/is_nan.py similarity index 100% rename from qurator/eynollah/utils/is_nan.py rename to src/eynollah/utils/is_nan.py diff --git a/qurator/eynollah/utils/marginals.py b/src/eynollah/utils/marginals.py similarity index 100% rename from qurator/eynollah/utils/marginals.py rename to src/eynollah/utils/marginals.py diff --git a/qurator/eynollah/utils/pil_cv2.py b/src/eynollah/utils/pil_cv2.py similarity index 100% rename from qurator/eynollah/utils/pil_cv2.py rename to src/eynollah/utils/pil_cv2.py diff --git a/qurator/eynollah/utils/resize.py b/src/eynollah/utils/resize.py similarity index 100% rename from qurator/eynollah/utils/resize.py rename to src/eynollah/utils/resize.py diff --git a/qurator/eynollah/utils/rotate.py b/src/eynollah/utils/rotate.py similarity index 100% rename from qurator/eynollah/utils/rotate.py rename to src/eynollah/utils/rotate.py diff --git a/qurator/eynollah/utils/separate_lines.py b/src/eynollah/utils/separate_lines.py similarity index 100% rename from qurator/eynollah/utils/separate_lines.py rename to src/eynollah/utils/separate_lines.py diff --git a/qurator/eynollah/utils/xml.py b/src/eynollah/utils/xml.py similarity index 100% rename from qurator/eynollah/utils/xml.py rename to src/eynollah/utils/xml.py diff --git a/qurator/eynollah/writer.py b/src/eynollah/writer.py similarity index 100% rename from qurator/eynollah/writer.py rename to src/eynollah/writer.py diff --git a/tests/test_counter.py b/tests/test_counter.py index 8ef0756..42bf074 100644 --- a/tests/test_counter.py +++ b/tests/test_counter.py @@ -1,5 +1,5 @@ from tests.base import main -from qurator.eynollah.utils.counter import EynollahIdCounter +from eynollah.utils.counter import EynollahIdCounter def test_counter_string(): c = EynollahIdCounter() diff --git a/tests/test_dpi.py b/tests/test_dpi.py index 510ffc5..3376bf4 100644 --- a/tests/test_dpi.py +++ b/tests/test_dpi.py @@ -1,6 +1,6 @@ import cv2 from pathlib import Path -from qurator.eynollah.utils.pil_cv2 import check_dpi +from eynollah.utils.pil_cv2 import check_dpi from tests.base import main def test_dpi(): diff --git a/tests/test_run.py b/tests/test_run.py index b1137e7..2596dad 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -2,7 +2,7 @@ from os import environ from pathlib import Path from ocrd_utils import pushd_popd from tests.base import CapturingTestCase as TestCase, main -from qurator.eynollah.cli import main as eynollah_cli +from eynollah.cli import main as eynollah_cli testdir = Path(__file__).parent.resolve() diff --git a/tests/test_smoke.py b/tests/test_smoke.py index d069479..252213f 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -1,7 +1,7 @@ def test_utils_import(): - import qurator.eynollah.utils - import qurator.eynollah.utils.contour - import qurator.eynollah.utils.drop_capitals - import qurator.eynollah.utils.drop_capitals - import qurator.eynollah.utils.is_nan - import qurator.eynollah.utils.rotate + import eynollah.utils + import eynollah.utils.contour + import eynollah.utils.drop_capitals + import eynollah.utils.drop_capitals + import eynollah.utils.is_nan + import eynollah.utils.rotate diff --git a/tests/test_xml.py b/tests/test_xml.py index 8422fd1..09a6ddf 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -1,5 +1,5 @@ from pytest import main -from qurator.eynollah.utils.xml import create_page_xml +from eynollah.utils.xml import create_page_xml from ocrd_models.ocrd_page import to_xml PAGE_2019 = 'http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15'