Skip to content

Connectors dependencies autoinstall #82

@federico-razzoli

Description

@federico-razzoli

Most Connectors require one additional module. For example, to use the MariaDB Connector you need the mariadb Python module. Currently, these modules are listed in the global requirements.txt, so they're always installed. As the number of Connectors grows, a user might want to only install the necessary dependencies for security reasons, or just to reduce the environment's size.

Each Connector has an info dictionary. Let's start by adding a dependencies property, which is a list, to allow Connector authors to declare the dependencies that need be installed. Authors can use the full pip syntax, with or without a version number.

Add a new dependency_mode setting, to allow the use to control how Connectors dependencies are installed.

When dependency_mode=auto (easy mode):

  1. Read configuration, populate an array of needed Connectors
  2. For each needed Connector, read the Connector.info.dependencies list, add each list to a modules_to_install list.
  3. Try to import each module, delete from the list those that are installed.
  4. Start a pip subprocess that installs all modules found in modules_to_install.

When dependency_mode=manual (safe mode):

  1. Read configuration, populate an array of needed Connectors
  2. For each needed Connector, read the Connector.info.dependencies list, add each list to a modules_to_install list.
  3. Try to import each module, delete from the list those that are installed.
  4. Produce a missing_requirements.txt file.
  5. Exit with code 3 (which shouldn't be used for anything else), and a clear error that asks the user to review missing_requirements.txt and manually install the modules listed in it. Also inform the user that those modules might be installed automatically with dependency_mode=auto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions