Merge branch 'ci'

This commit is contained in:
James R. Barlow 2021-06-10 00:30:32 -07:00
commit 4cce0077d0
15 changed files with 141 additions and 108 deletions

View File

@ -37,12 +37,7 @@ COPY . /app
WORKDIR /app
RUN pip3 install --no-cache-dir \
-r requirements/main.txt \
-r requirements/webservice.txt \
-r requirements/test.txt \
-r requirements/watcher.txt \
.
RUN pip3 install --no-cache-dir .[test,webservice,watcher]
FROM base

View File

@ -67,7 +67,7 @@ jobs:
- name: Install Python packages
run: |
python -m pip install -r requirements/main.txt -r requirements/test.txt .
python -m pip install .[test]
- name: Report versions
run: |
@ -124,7 +124,7 @@ jobs:
- name: Install Python packages
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/main.txt -r requirements/test.txt .
python -m pip install .[test]
- name: Report versions
run: |
@ -174,7 +174,7 @@ jobs:
- name: Install Python packages
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/main.txt -r requirements/test.txt .
python -m pip install .[test]
- name: Test
run: |

3
.gitignore vendored
View File

@ -6,8 +6,9 @@
!.gitattributes
!.gitignore
!.pre-commit-config.yaml
!.readthedocs.yml
!.readthedocs.yaml
!.github/
!.docker/
# Dev scratch
*.ipynb

22
.readthedocs.yaml Normal file
View File

@ -0,0 +1,22 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# Optionally build your docs in additional formats such as PDF
formats:
- pdf
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs

View File

@ -1,10 +0,0 @@
build:
image: latest
python:
version: 3.6
formats:
- pdf
requirements_file: requirements/main.txt

View File

@ -111,7 +111,7 @@ Users may need to customize the script to meet their requirements.
.. code-block:: bash
pip3 install -r requirements/watcher.txt
pip3 install ocrmypdf[watcher]
env OCR_INPUT_DIRECTORY=/mnt/input-pdfs \
OCR_OUTPUT_DIRECTORY=/mnt/output-pdfs \

View File

@ -812,8 +812,7 @@ To install all of the development and test requirements:
python3 -m venv
source venv/bin/activate
cd OCRmyPDF
pip install -e .
pip install -r requirements/dev.txt -r requirements/test.txt
pip install -e .[test]
To add JBIG2 encoding, see :ref:`jbig2`.

View File

@ -3,11 +3,14 @@ requires = [
"setuptools >= 30.3.0",
"wheel",
"cffi",
"setuptools_scm",
"setuptools_scm[toml] >= 3.4",
"setuptools_scm_git_archive"
]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
version_scheme = "post-release"
[tool.black]
line-length = 88
target-version = ["py36", "py37", "py38"]

View File

@ -1,6 +1,4 @@
# requirements.txt can be used to replicate the developer's build environment
# setup.py lists a separate set of requirements that are looser to simplify
# installation
# Deprecated and not maintained; use "pip install ocrmypdf" instead
cffi == 1.14.5
coloredlogs == 15.0 # technically optional
img2pdf == 0.4.0

View File

@ -1,3 +1,4 @@
# Deprecated and not maintained; use "pip install ocrmypdf[test]" instead
pytest >= 6.0.0
pytest-xdist >= 2.2.0
pytest-cov >= 2.11.1

View File

@ -1 +1,2 @@
# Deprecated and not maintained; use "pip install ocrmypdf[watcher]" instead
watchdog == 1.0.2

View File

@ -1 +1,2 @@
# Deprecated and not maintained; use "pip install ocrmypdf[webservice]" instead
Flask >= 1, < 2

108
setup.cfg
View File

@ -1,8 +1,101 @@
[metadata]
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
url = https://github.com/jbarlow83/OCRmyPDF
author = James R. Barlow
author_email = james@purplerock.ca
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
Intended Audience :: Science/Research
Intended Audience :: System Administrators
License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows :: Windows 10
Operating System :: POSIX
Operating System :: POSIX :: BSD
Operating System :: POSIX :: Linux
Topic :: Scientific/Engineering :: Image Recognition
Topic :: Text Processing :: Indexing
Topic :: Text Processing :: Linguistic
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:
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
[options.package_data]
ocrmypdf =
data/sRGB.icc
py.typed
[options.packages.find]
where = src
[options.extras_require]
test =
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
extended_test =
PyMuPDF == 1.13.4
watcher =
watchdog >= 1.0.2, < 2
webservice =
Flask >= 1, < 2
[options.entry_points]
console_scripts =
ocrmypdf = ocrmypdf.__main__:run
[bdist_wheel]
python-tag = py36
[aliases]
test=pytest
test = pytest
[check-manifest]
ignore =
@ -19,17 +112,14 @@ addopts =
-n auto
[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88
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
[metadata]
license_file = LICENSE
[coverage:paths]
source =
src/ocrmypdf

View File

@ -1,62 +1,16 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# © 2015 James R. Barlow: github.com/jbarlow83
# © 2021 James R. Barlow: github.com/jbarlow83
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
import sys
from setuptools import find_packages, setup
if sys.version_info < (3, 6):
print("Python 3.6 or newer is required", file=sys.stderr)
sys.exit(1)
tests_require = open('requirements/test.txt', encoding='utf-8').read().splitlines()
def readme():
with open('README.md', encoding='utf-8') as f:
return f.read()
from setuptools import setup
# Minimal setup to support older setuptools/setuptools_scm
setup(
name='ocrmypdf',
description='OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched',
long_description=readme(),
long_description_content_type='text/markdown',
url='https://github.com/jbarlow83/OCRmyPDF',
author='James R. Barlow',
author_email='james@purplerock.ca',
packages=find_packages('src', exclude=["tests", "tests.*"]),
package_dir={'': 'src'},
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",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: POSIX",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering :: Image Recognition",
"Topic :: Text Processing :: Indexing",
"Topic :: Text Processing :: Linguistic",
],
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
@ -64,26 +18,4 @@ setup(
],
use_scm_version={'version_scheme': 'post-release'},
cffi_modules=['src/ocrmypdf/lib/compile_leptonica.py:ffibuilder'],
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.1.2',
'pluggy >= 0.13.0, < 1.0',
'reportlab >= 3.5.66',
'setuptools',
'tqdm >= 4',
],
tests_require=tests_require,
entry_points={'console_scripts': ['ocrmypdf = ocrmypdf.__main__:run']},
package_data={'ocrmypdf': ['data/sRGB.icc', 'py.typed']},
include_package_data=True,
zip_safe=False,
project_urls={
'Documentation': 'https://ocrmypdf.readthedocs.io/',
'Source': 'https://github.com/jbarlow83/ocrmypdf',
'Tracker': 'https://github.com/jbarlow83/ocrmypdf/issues',
},
)

View File

@ -28,7 +28,7 @@
- Search for deprecation: search all files for deprec*, etc.
- Check requirements/*
- Check requirements in setup.cfg
- Delete `tests/cache`, do `pytest --runslow`, and update cache.