From 8a3b82e364aec0c55d52a697ac06745c25c871ce Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 2 Aug 2022 14:46:01 -0700 Subject: [PATCH] Make Python 3.8 minimum requirement --- .github/workflows/build.yml | 2 -- .readthedocs.yaml | 2 +- README.md | 2 +- docs/api.rst | 8 -------- docs/installation.rst | 4 ++-- setup.cfg | 6 ++---- src/ocrmypdf/__main__.py | 2 -- src/ocrmypdf/subprocess/_windows.py | 5 ----- tests/test_stdio.py | 4 ---- 9 files changed, 6 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a895b0fc..0615005e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,8 +20,6 @@ jobs: strategy: matrix: include: - - os: ubuntu-18.04 - python: "3.7" - os: ubuntu-20.04 python: "3.8" - os: ubuntu-20.04 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 38fa8dce..cc3e49f4 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -14,7 +14,7 @@ formats: # Optionally set the version of Python and requirements required to build your docs python: - version: "3.7" + version: "3.8" install: - method: pip path: . diff --git a/README.md b/README.md index 6d7a0a35..e90526c8 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Linux, Windows, macOS and FreeBSD are supported. Docker images are also availabl | macOS (Homebrew) | ``brew install ocrmypdf`` | | macOS (nix) | ``nix-env -i ocrmypdf`` | | LinuxBrew | ``brew install ocrmypdf`` | -| FreeBSD | ``pkg install py37-ocrmypdf`` | +| FreeBSD | ``pkg install py38-ocrmypdf`` | | Conda | ``conda install ocrmypdf`` | | Ubuntu Snap | ``snap install ocrmypdf`` | diff --git a/docs/api.rst b/docs/api.rst index 0478dd1c..1f185446 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -72,14 +72,6 @@ OCRmyPDF, use processes. not take at least one of these steps, process semantics will prevent OCRmyPDF from working correctly. -.. warning:: - - On macOS with Python 3.7, you must call - :func:`multiprocessing.set_start_method("spawn")`. Without this, multiprocessing - will be unstable. From the command line, OCRmyPDF does this automatically, - but as an API user you must do this. See Python bpo-33725 for details. - Python 3.8+ also resolve this automatically. - Logging ------- diff --git a/docs/installation.rst b/docs/installation.rst index 79bfb7c4..dd53dc88 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -417,7 +417,7 @@ Native Windows You must install the following for Windows: -* Python 3.7 (64-bit) or later +* Python 3.8 (64-bit) or later * Tesseract 4.0 or later * Ghostscript 9.50 or later @@ -649,7 +649,7 @@ unfortunately, the ``pip install`` command cannot satisfy all of them. Installing HEAD revision from sources ===================================== -If you have ``git`` and Python 3.7 or newer installed, you can install +If you have ``git`` and Python 3.8 or newer installed, you can install from source. When the ``pip`` installer runs, it will alert you if dependencies are missing. diff --git a/setup.cfg b/setup.cfg index 3dc89171..20207083 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,6 @@ classifiers = Operating System :: POSIX :: Linux Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -54,10 +53,9 @@ install_requires = pluggy>=0.13.0 reportlab>=3.5.66 tqdm>=4 - importlib-metadata>=4;python_version<'3.8' # until Python 3.8 importlib-resources>=5;python_version<'3.9' # until Python 3.9 typing-extensions>=4;python_version<'3.10' -python_requires = >=3.7 +python_requires = >=3.8 include_package_data = True package_dir = =src @@ -100,7 +98,7 @@ ocrmypdf = py.typed [bdist_wheel] -python-tag = py37 +python-tag = py38 [aliases] test = pytest diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py index 24d620c8..24a64ae9 100755 --- a/src/ocrmypdf/__main__.py +++ b/src/ocrmypdf/__main__.py @@ -71,6 +71,4 @@ def run(args=None): if __name__ == '__main__': - if sys.platform == 'darwin' and sys.version_info < (3, 8): - set_start_method('spawn') # see python bpo-33725 sys.exit(run()) diff --git a/src/ocrmypdf/subprocess/_windows.py b/src/ocrmypdf/subprocess/_windows.py index 3a6c2a39..46f68931 100644 --- a/src/ocrmypdf/subprocess/_windows.py +++ b/src/ocrmypdf/subprocess/_windows.py @@ -171,11 +171,6 @@ SHIMS = [ def fix_windows_args(program: str, args, env): """Adjust our desired program and command line arguments for use on Windows""" - if sys.version_info < (3, 8): - # bpo-33617 - Windows needs manual Path -> str conversion - args = [os.fspath(arg) for arg in args] - program = os.fspath(program) - # If we are running a .py on Windows, ensure we call it with this Python # (to support test suite shims) if program.lower().endswith('.py'): diff --git a/tests/test_stdio.py b/tests/test_stdio.py index 17536145..577ec607 100644 --- a/tests/test_stdio.py +++ b/tests/test_stdio.py @@ -51,10 +51,6 @@ def test_stdout(ocrmypdf_exec, resources, outpdf): assert check_pdf(output_file) -@pytest.mark.xfail( - os.name == 'nt' and sys.version_info < (3, 8), - reason="Windows does not like this; not sure how to fix", -) def test_dev_null(resources): if 'COV_CORE_DATAFILE' in os.environ: pytest.skip("Coverage uses stdout")