jina.importer module

class jina.importer.ImportExtensions(required, logger=None, help_text=None, pkg_name=None, verbose=True)[source]

Bases: object

A context manager for wrapping extension import and fallback. It guides the user to pip install correct package by looking up extra-requirements.txt.

Parameters
  • required (bool) – set to True if you want to raise the ModuleNotFound error

  • logger – when not given, built-in warnings.warn will be used

  • help_text (Optional[str]) – the help text followed after

  • pkg_name (Optional[str]) – the package name to find in extra_requirements.txt, when not given the ModuleNotFound exec_val will be used as the best guess

class jina.importer.PathImporter[source]

Bases: object

The class to import modules from paths.

static add_modules(*paths)[source]

Import modules from paths.

Parameters

paths – Paths of the modules.