diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index fdefd2b..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include assets/example.jpg diff --git a/README.md b/README.md index e6beaae..5dec093 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,16 @@ See also: # Installation -You need Python 3.8, 3.9, 3.10 or 3.11. +You need Python 3.6 or newer. Please note, that the newest Python release might not be supported due to a PyTorch dependency, which often breaks with new Python releases and needs some time to catch up. +Refer to [PyTorch website](https://pytorch.org/get-started/locally/) for a list of supported Python versions. + +Some users have reported problems with Python installed from Microsoft Store. If you see an error: +`ImportError: DLL load failed while importing fugashi: The specified module could not be found.`, +try installing Python from the [official site](https://www.python.org/downloads). If you want to run with GPU, install PyTorch as described [here](https://pytorch.org/get-started/locally/#start-locally), otherwise this step can be skipped. -Run in command line: - -```commandline -pip3 install manga-ocr -``` - ## Troubleshooting - `ImportError: DLL load failed while importing fugashi: The specified module could not be found.` - might be because of Python installed from Microsoft Store, try installing Python from the [official site](https://www.python.org/downloads) diff --git a/manga_ocr/__init__.py b/manga_ocr/__init__.py index c90862b..14fd587 100644 --- a/manga_ocr/__init__.py +++ b/manga_ocr/__init__.py @@ -1,3 +1,2 @@ -__version__ = "0.1.11" - +from ._version import __version__ from manga_ocr.ocr import MangaOcr diff --git a/manga_ocr/_version.py b/manga_ocr/_version.py new file mode 100644 index 0000000..0c5c300 --- /dev/null +++ b/manga_ocr/_version.py @@ -0,0 +1 @@ +__version__ = "0.1.11" diff --git a/assets/example.jpg b/manga_ocr/assets/example.jpg similarity index 100% rename from assets/example.jpg rename to manga_ocr/assets/example.jpg diff --git a/manga_ocr/ocr.py b/manga_ocr/ocr.py index d4faf52..25e4576 100644 --- a/manga_ocr/ocr.py +++ b/manga_ocr/ocr.py @@ -32,7 +32,7 @@ def __init__( example_path = Path(__file__).parent / "assets/example.jpg" if not example_path.is_file(): - example_path = Path(__file__).parent.parent / "assets/example.jpg" + raise FileNotFoundError(f"Missing example image {example_path}") self(example_path) logger.info("OCR ready") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c8f5def --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[project] +name = "manga-ocr" +authors = [ + {name = "Maciej Budyś", email = "kha-white@mail.com"}, +] +description = "OCR for Japanese manga" +readme = "README.md" +requires-python = ">=3.6" +license = {file = "LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3", +] + +dynamic = ["version"] +dependencies = [ + "fire", + "fugashi", + "jaconv", + "loguru", + "numpy<2", + "Pillow>=10.0.0", + "pyperclip", + "torch>=1.0", + "transformers>=4.25.0", + "unidic_lite", +] + +[project.urls] +Homepage = "https://github.com/kha-white/manga-ocr" + +[build-system] +requires = ["setuptools >= 61.0.0", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["manga_ocr"] + +[tool.setuptools.dynamic] +version = {attr = "manga_ocr._version.__version__"} + +[project.scripts] +manga_ocr = "manga_ocr.__main__:main" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 50227a9..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -fire -fugashi -jaconv -loguru -numpy -Pillow>=10.0.0 -pyperclip -torch>=1.0 -transformers>=4.25.0 -unidic_lite diff --git a/setup.py b/setup.py deleted file mode 100644 index 347502e..0000000 --- a/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -from pathlib import Path -from setuptools import setup - -long_description = ( - (Path(__file__).parent / "README.md").read_text("utf-8").split("# Installation")[0] -) - -setup( - name="manga-ocr", - version="0.1.11", - description="OCR for Japanese manga", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/kha-white/manga-ocr", - author="Maciej Budyś", - author_email="kha-white@mail.com", - license="Apache License 2.0", - classifiers=[ - "Programming Language :: Python :: 3", - ], - packages=["manga_ocr"], - include_package_data=True, - install_requires=[ - "fire", - "fugashi", - "jaconv", - "loguru", - "numpy", - "Pillow>=10.0.0", - "pyperclip", - "torch>=1.0", - "transformers>=4.25.0", - "unidic_lite", - ], - entry_points={ - "console_scripts": [ - "manga_ocr=manga_ocr.__main__:main", - ] - }, -)