ocrmypdf/OCRmyPDF · warning · DeprecationWarning

semfree.py is deprecated and will be removed in a future rel

Error message

semfree.py is deprecated and will be removed in a future release.

What it means

Module-level DeprecationWarning fired on importing ocrmypdf.extra_plugins.semfree: the semfree plugin will be removed in a future release. Importing it still works for now.

Source

Thrown at src/ocrmypdf/extra_plugins/semfree.py:39

from __future__ import annotations

import logging
import logging.handlers
import signal
import warnings
from collections.abc import Callable, Iterable, Iterator
from contextlib import suppress
from enum import Enum, auto
from itertools import islice, repeat, takewhile, zip_longest
from multiprocessing import Pipe, Process
from multiprocessing.connection import Connection, wait

from ocrmypdf import Executor, hookimpl
from ocrmypdf._concurrent import NullProgressBar
from ocrmypdf.exceptions import InputFileError
from ocrmypdf.helpers import remove_all_log_handlers

warnings.warn(
    "semfree.py is deprecated and will be removed in a future release.",
    DeprecationWarning,
)


class MessageType(Enum):
    """Implement basic IPC messaging."""

    exception = auto()  # pylint: disable=invalid-name
    result = auto()  # pylint: disable=invalid-name
    complete = auto()  # pylint: disable=invalid-name


def split_every(n: int, iterable: Iterable) -> Iterator:
    """Split iterable into groups of n.

    >>> list(split_every(4, range(10)))
    [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Plan migration off semfree before upgrading to the release that removes it
  2. Check release notes for a replacement concurrency plugin or built-in behavior
  3. Silence temporarily with warnings.filterwarnings('ignore', category=DeprecationWarning, module='.*semfree')

Example fix

# before
ocrmypdf.ocr('in.pdf','out.pdf', plugins=['ocrmypdf.extra_plugins.semfree'])
# after
ocrmypdf.ocr('in.pdf','out.pdf')  # once migrated off semfree
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util\nif importlib.util.find_spec('ocrmypdf.extra_plugins.semfree'):\n    plan_migration()

Try / catch

with warnings.catch_warnings():\n    warnings.simplefilter('ignore', DeprecationWarning)\n    import ocrmypdf.extra_plugins.semfree

Prevention

When it happens

Trigger: import ocrmypdf.extra_plugins.semfree or listing it in the plugins= argument to ocrmypdf.ocr().

Common situations: Users of the semaphore-free concurrent execution plugin upgrading OCRmyPDF; plugin lists persisted in config/scripts.

Related errors


AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27). Data as JSON: /api/errors/68da06a236c7f71a. Report an issue: GitHub.