From 1b46481f7e694d2ad097f9a826e4d25e6157d022 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 26 Aug 2021 17:59:40 -0700 Subject: [PATCH] pre-commit: add setup.cfg fmt --- .pre-commit-config.yaml | 4 ++ pyproject.toml | 2 +- setup.cfg | 116 +++++++++++++++++++++------------------- tests/test_pipeline.py | 6 +-- 4 files changed, 67 insertions(+), 61 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3cd240e2..38e9419f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,3 +21,7 @@ repos: - id: black language_version: python exclude: ^src/ocrmypdf/lib/_leptonica.py + - repo: https://github.com/asottile/setup-cfg-fmt + rev: v1.17.0 + hooks: + - id: setup-cfg-fmt diff --git a/pyproject.toml b/pyproject.toml index 6a96810d..0ad451d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ exclude_lines = [ [tool.isort] profile = "black" known_first_party = "ocrmypdf" -known_third_party = ["PIL","_cffi_backend","cffi","flask","img2pdf","pdfminer","pikepdf","pkg_resources","pluggy","pytest","reportlab","setuptools","sphinx_rtd_theme","tqdm","watchdog","werkzeug"] +known_third_party = ["PIL", "_cffi_backend", "cffi", "flask", "img2pdf", "ocrmypdf", "pdfminer", "pikepdf", "pkg_resources", "pluggy", "pytest", "reportlab", "setuptools", "sphinx_rtd_theme", "tqdm", "watchdog", "werkzeug"] [tool.pytest.ini_options] minversion = "6.0" diff --git a/setup.cfg b/setup.cfg index d0ecf331..8c760454 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,23 +2,15 @@ name = ocrmypdf description = OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched long_description = file: README.md -long_description_content_type = text/markdown; charset=UTF-8 +long_description_content_type = text/markdown url = https://github.com/jbarlow83/OCRmyPDF author = James R. Barlow author_email = james@purplerock.ca +license = MPL-2.0 +license_file = LICENSE license_files = LICENSE -keywords = - PDF - OCR - optical character recognition - PDF/A - scanning classifiers = - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: End Users/Desktop @@ -30,69 +22,81 @@ classifiers = Operating System :: POSIX Operating System :: POSIX :: BSD Operating System :: POSIX :: Linux + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 Topic :: Scientific/Engineering :: Image Recognition Topic :: Text Processing :: Indexing Topic :: Text Processing :: Linguistic +keywords = + PDF + OCR + optical character recognition + PDF/A + scanning project_urls = Documentation = https://ocrmypdf.readthedocs.io/ Source = https://github.com/jbarlow83/ocrmypdf Tracker = https://github.com/jbarlow83/ocrmypdf/issues [options] -zip_safe = False packages = find: +install_requires = + Pillow>=8.2.0 + cffi>=1.9.1 # must be a setup and install requirement + coloredlogs>=14.0 # strictly optional + img2pdf>=0.3.0,<0.5 # pure Python + pdfminer.six!=20200720,>=20191110,<=20201018 + pikepdf>=2.10.0 + pluggy>=0.13.0,<1.0 + reportlab>=3.5.66 + setuptools + tqdm>=4 +python_requires = >=3.6 +include_package_data = True package_dir = =src platforms = any -include_package_data=True -install_requires = - cffi >= 1.9.1 # must be a setup and install requirement - coloredlogs >= 14.0 # strictly optional - img2pdf >= 0.3.0, < 0.5 # pure Python, so track HEAD closely - pdfminer.six >= 20191110, != 20200720, <= 20201018 - pikepdf >= 2.10.0 - Pillow >= 8.2.0 - pluggy >= 0.13.0, < 1.0 - reportlab >= 3.5.66 - setuptools - tqdm >= 4 -python_requires = >= 3.6 -setup_requires = # can be removed whenever we can drop pip 9 support - cffi >= 1.9.1 # to build the leptonica module - setuptools_scm # so that version will work - setuptools_scm_git_archive # enable version from github tarballs +setup_requires = + # + cffi>=1.9.1 # to build the leptonica module + setuptools_scm + setuptools_scm_git_archive +zip_safe = False + +[options.packages.find] +where = src + +[options.entry_points] +console_scripts = + ocrmypdf = ocrmypdf.__main__:run + +[options.extras_require] +docs = + sphinx + sphinx-issues + sphinx-rtd-theme +extended_test = + PyMuPDF==1.13.4 +test = + coverage[toml]>=5 + pytest>=6.0.0 + pytest-cov>=2.11.1 + pytest-xdist>=2.2.0 + python-xmp-toolkit==2.0.1 # also requires apt-get install libexempi3 +watcher = + watchdog>=1.0.2,<3 +webservice = + Flask>=1,<3 [options.package_data] ocrmypdf = data/sRGB.icc py.typed -[options.packages.find] -where = src - -[options.extras_require] -test = - coverage[toml] >= 5 - pytest >= 6.0.0 - pytest-xdist >= 2.2.0 - pytest-cov >= 2.11.1 - python-xmp-toolkit == 2.0.1 # also requires apt-get install libexempi3 - # or brew install exempi -docs = - sphinx - sphinx-rtd-theme - sphinx-issues -extended_test = - PyMuPDF == 1.13.4 -watcher = - watchdog >= 1.0.2, < 3 -webservice = - Flask >= 1, < 3 - -[options.entry_points] -console_scripts = - ocrmypdf = ocrmypdf.__main__:run - [bdist_wheel] python-tag = py36 @@ -101,4 +105,4 @@ test = pytest [check-manifest] ignore = - .github + .github diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index becef2c4..41cb0f04 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -79,9 +79,7 @@ def test_dpi_needed(image, text, vector, result, rgb_image, outdir): # Input: ('', '', '', '', ''), # Output: - ( - ((1, 5), None), - ), + (((1, 5), None),), ), ( 'no_empty_values', @@ -147,4 +145,4 @@ def test_dpi_needed(image, text, vector, result, rgb_image, outdir): ), ) def test_enumerate_compress_ranges(name, input, output): - assert output == tuple(_pipeline.enumerate_compress_ranges(input)) \ No newline at end of file + assert output == tuple(_pipeline.enumerate_compress_ranges(input))