def update_env(env_file): script = "conda env update --file %s" % (env_file) print("* Updating conda environment") execute_script( script, "Successfully updated conda environment", "Error while updating conda environment", ) validate()
def install_env(env_file, env_name): script = "conda env create -n %s -f %s" % ( env_name, env_file, ) print("* Installing conda environment %s" % env_name) execute_script( script, "Successfully installed conda environment", "Error while installing conda environment", ) validate(env_name)
def install_labextensions(labext_file, env_name=None): with open(labext_file, "r") as fd: extensions = " ".join(fd.read().split("\n")) script = _set_conda_env(env_name) script += "jupyter labextension install --no-build %s\n" % extensions script += "jupyter lab build --dev-build=True --minimize=False\n" print("* Installing jupyterlab extensions") execute_script( script, "Successfully installed jupyter labextensions", "Error while installing jupyter labextensions", ) validate(env_name, labext=True)
def validate(env_name=None, labext=False): script = _set_conda_env(env_name) if labext: script += "jupyter-labextension list" else: script += """ pip show databrickslabs_jupyterlab jupyter-serverextension list """ print("* Validating conda environment") execute_script( script, "Successfully validated conda environment", "Error while validating conda environment", )