import_optional, a context manager that catches ImportError and
re-raises it with a human-readable install hint (e.g. pip install <package>[extra]),
and nltk_check, a variant tailored to NLTK data-download errors. Used by Granite
formatter modules that have optional third-party dependencies.
Functions
FUNC import_optional
extra_name: Package extra to suggest in the install hint (e.g.pip install granite_io[extra_name]).
FUNC nltk_check
feature_name: Name of the feature that requires NLTK, used in the error message.
ImportError: If thenltkpackage is not installed, re-raised with a descriptive message and installation instructions.