Skip to content

Support for tolerating missing soft dependency #375

@andy-maier

Description

@andy-maier

The Sphinx package has a "soft" dependency on the "Levenshtein" package: It attempts to import it, but tolerates it when not installed. The corresponding source code is (from https://github.com/sphinx-doc/sphinx/blob/master/sphinx/versioning.py#L22):

try:
    import Levenshtein  # type: ignore[import-not-found]

    IS_SPEEDUP = True
except ImportError:
    IS_SPEEDUP = False

The type: ignore[import-not-found] marker was added in Sphinx 7.3.0. It is used by the "mypy" tool and causes it to tolerate that the package is not installed.

I suggest that pip-check-reqs also introduces support for tolerating a missing soft dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions