mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -6,18 +6,12 @@ from tljh.hooks import hookimpl
|
||||
|
||||
@hookimpl
|
||||
def tljh_extra_user_conda_packages():
|
||||
return [
|
||||
"hypothesis",
|
||||
"csvtk",
|
||||
"tqdm"
|
||||
]
|
||||
return ["hypothesis", "csvtk", "tqdm"]
|
||||
|
||||
|
||||
@hookimpl
|
||||
def tljh_extra_user_conda_channels():
|
||||
return [
|
||||
"conda-forge",
|
||||
"bioconda"
|
||||
]
|
||||
return ["conda-forge", "bioconda"]
|
||||
|
||||
|
||||
@hookimpl
|
||||
|
||||
@@ -33,6 +33,7 @@ def test_conda_packages():
|
||||
subprocess.check_call([f"{USER_ENV_PREFIX}/bin/python3", "-c", "import hypothesis"])
|
||||
subprocess.check_call([f"{USER_ENV_PREFIX}/bin/csvtk", "cat", "--help"])
|
||||
|
||||
|
||||
def test_tljh_extra_apt_packages():
|
||||
assert os.path.exists("/usr/games/sl")
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ def test_ensure_channel_packages(prefix):
|
||||
"""
|
||||
Test installing packages in conda environment
|
||||
"""
|
||||
conda.ensure_conda_packages(prefix, ["csvtk"], channels=('conda-forge', 'bioconda'))
|
||||
conda.ensure_conda_packages(prefix, ["csvtk"], channels=("conda-forge", "bioconda"))
|
||||
# Throws an error if this fails
|
||||
subprocess.check_call([os.path.join(prefix, "bin", "csvtk"), "cat", "--help"])
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ def tljh_extra_user_conda_channels():
|
||||
"""
|
||||
Return a list of conda channels to be used during user environment installation.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
|
||||
@@ -452,14 +452,16 @@ def run_plugin_actions(plugin_manager):
|
||||
conda_packages = list(set(itertools.chain(*hook.tljh_extra_user_conda_packages())))
|
||||
conda_channels = list(itertools.chain(*hook.tljh_extra_user_conda_channels()))
|
||||
if len(conda_channels) == 0:
|
||||
conda_channels = ('conda-forge',)
|
||||
conda_channels = ("conda-forge",)
|
||||
if conda_packages:
|
||||
logger.info(
|
||||
"Installing {} user conda packages collected from plugins: {}".format(
|
||||
len(conda_packages), " ".join(conda_packages)
|
||||
)
|
||||
)
|
||||
conda.ensure_conda_packages(USER_ENV_PREFIX, conda_packages, conda_channels=conda_channels)
|
||||
conda.ensure_conda_packages(
|
||||
USER_ENV_PREFIX, conda_packages, conda_channels=conda_channels
|
||||
)
|
||||
|
||||
# Install pip packages
|
||||
user_pip_packages = list(set(itertools.chain(*hook.tljh_extra_user_pip_packages())))
|
||||
|
||||
Reference in New Issue
Block a user