Example #1
0
def is_pypi_release():
    is_installed_package = hasattr(version_mod, 'version_json')
    is_tagged = not BENTOML_VERSION.startswith('0+untagged')
    is_clean = not version_mod.get_versions()['dirty']
    return is_installed_package and is_tagged and is_clean
Example #2
0
def _is_pip_installed_bentoml():
    is_installed_package = hasattr(version_mod, 'version_json')
    is_tagged = not __version__.startswith('0+untagged')
    is_clean = not version_mod.get_versions()['dirty']
    return is_installed_package and is_tagged and is_clean
Example #3
0
DEFAULT_BENTOML_HOME = expand_env_var(
    os.environ.get("BENTOML_HOME", "~/bentoml"))
BENTOML_HOME = DEFAULT_BENTOML_HOME

# This is used as default for config('core', 'bentoml_deploy_version') - which is used
# for getting the BentoML PyPI version string or the URL to a BentoML sdist, indicating
# the BentoML module to be used when loading and using a saved BentoService archive.
# This is useful when using customized BentoML fork/branch or when working with
# development branches of BentoML
BENTOML_VERSION = __version__

# e.g. from '0.4.2+5.g6cac97f.dirty' to '0.4.2'
PREV_PYPI_RELEASE_VERSION = __version__.split('+')[0]

if version_mod.get_versions()['dirty']:
    # Reset to LAST_PYPI_RELEASE_VERSION if bentoml module is 'dirty'
    # This will be used as default value of 'core/deploy_bentoml_version' config
    BENTOML_VERSION = PREV_PYPI_RELEASE_VERSION


def get_local_config_file():
    if "BENTOML_CONFIG" in os.environ:
        # User local config file for customizing bentoml
        return expand_env_var(os.environ.get("BENTOML_CONFIG"))
    else:
        return os.path.join(BENTOML_HOME, "bentoml.cfg")


def load_config():
    global BENTOML_HOME  # pylint: disable=global-statement