[RFC] Rework the dependencies to be more versatile (#951)
This PR proposes a change in the way optional dependencies are managed so that it's easier to shield tasks that have specific dependencies. See below for an explanation of the different changes.
The first change renames the `is_xxx_available() -> bool` methods to a more versatile `is_package_available(package_name: str) -> bool`.
This unbloats the `imports.py` module while adding two additional methods that work on top of it:
- `is_multilingual_package_available(language_code: Optional[str] = None) -> bool` which checks the presence of `spacy`, and optionally takes in a language code to check whether the language-related dependencies are installed.
- the `@requires(package_name)` decorator which can be added on top of classes/methods to raise an error as soon as any method of the class/the method is called, if the package isn't installed.
FYI: this is a draft PR that isn't tested at this point, and that I need to test in a real-world scenario. I'd like to validate the direction before adding relevant tests.