jina.hubble.requirements module#

Module for helper functions for parsing requirements file.

jina.hubble.requirements.parse_requirement(line)[source]#

Parses a Requirement from a line of a requirement file.

Parameters:

line (str) – a line of a requirement file

Return type:

Requirement

Returns:

a Requirement instance for the given line

jina.hubble.requirements.get_env_variables(line)[source]#

search the environment variable only match uppercase letter and number and the _ (underscore). :type line: str :param line: a line of a requirement file :rtype: List :return: a List of components

jina.hubble.requirements.check_env_variable(env_variable)[source]#

check the environment variables is limited to uppercase letter and number and the _ (underscore). :type env_variable: str :param env_variable: env_variable in the requirements.txt file :rtype: bool :return: True or False if not satisfied

jina.hubble.requirements.expand_env_variables(line)[source]#

Replace all environment variables that can be retrieved via os.getenv. The only allowed format for environment variables defined in the requirement file is ${MY_VARIABLE_1} to ensure two things: 1. Strings that contain a $ aren’t accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. Valid characters in variable names follow the POSIX standard and are limited to uppercase letter and number and the _ (underscore). Replace environment variables in requirement if it’s defined. :type line: str :param line: a line of a requirement file :rtype: str :return: line