the-littlest-jupyterhub
the-littlest-jupyterhub copied to clipboard
Define conda channel in tljh_extra_user_conda_packages hook
Proposed change
Enable the definition of custom conda channels in the tljh_extra_user_conda_packages
plugin hook. I often need to install conda packages from the bioconda
, fastai
, or local channels.
There is even a note on line 111 of tljh/conda.py
about making this customizable. I'm not sure of the most elegant way to adjust the code or configuration option to make the feature possible.
I could imagine new hook that allows the plugin to define the conda channels to use during install.
Alternative options
There could be a hacky way to use the tljh_post_install
hook to run a second conda install on the user environment, but this seems less ideal.
I also tried returning a list of conda packages from tljh_extra_user_conda_packages
that prefixed the channels like so:
def tljh_extra_user_conda_packages():
return ['-c', 'bioconda', 'snakemake']
which could add the channel to the conda command.
However, line: 372 of tlhj/installer.py
is
conda_packages = list(set(itertools.chain(*hook.tljh_extra_user_conda_packages())))
The set
operation destroys the order. One could remove the set
or replace it with a collections.OrderedDict
to ensure the order is preserved while still de-duplicating. That would allow the proper command to be created
{conda} install -c conda-forge --json --prefix {abspath} -c bioconda snakemake
Who would use this feature?
Bioinformatics researchers who provision TLHJ as a teaching tool or sharable workstation.
This is similar to #779 which suggests allowing an env.yaml
file for user requirements. It suggests that the same functionality is possible through plugins .... except if you need to define a new channel.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: