-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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):
- Read configuration, populate an array of needed Connectors
- For each needed Connector, read the
Connector.info.dependencieslist, add each list to amodules_to_installlist. - Try to import each module, delete from the list those that are installed.
- Start a
pipsubprocess that installs all modules found inmodules_to_install.
When dependency_mode=manual (safe mode):
- Read configuration, populate an array of needed Connectors
- For each needed Connector, read the
Connector.info.dependencieslist, add each list to amodules_to_installlist. - Try to import each module, delete from the list those that are installed.
- Produce a
missing_requirements.txtfile. - Exit with code 3 (which shouldn't be used for anything else), and a clear error that asks the user to review
missing_requirements.txtand manually install the modules listed in it. Also inform the user that those modules might be installed automatically with dependency_mode=auto.