Fancy Profile UI for jupyterhub-kubespawner
Project description
jupyterhub-fancy-profiles
A react based, fancy implementation of user selectable profiles for use with jupyterhub-kubespawner.
Features
-
Interpret a
profileList
given to kubespawner, and render a better looking and more featureful selector. This includes descriptions for various options, as well as better descriptions for allowing users to 'write-in' a choice. -
If enabled, interact with a binderhub deployed as a JupyterHub service to allow users to dynamically build images they want to use, without requiring it to be pre-built.
Limitations
-
While multiple
profile_options
are supported, only a singleprofile
is supported. -
The forms values don't remember their previous state upon refresh
How to use
Using with z2jh
This package can be used with any installation of KubeSpawner, but is most
commonly used with an installation of z2jh. It requires installing jupyterhub-fancy-profiles
in the hub
image used by z2jh.
As a convenience, we build and push docker images that can be automatically used with z2jh!
-
Look at the list of available tags and find a tag that matches the version of z2jh you are using.
-
Use this image in the z2jh config. In the
values.yaml
file you pass tohelm
, use the following:hub: image: name: quay.io/yuvipanda/z2jh-hub-with-fancy-profiles tag: <tag-from-the-list> extraConfig: 01-enable-fancy-profiles: | from jupyterhub_fancy_profiles import setup_ui setup_ui(c)
-
Run a
helm upgrade
and you should have fancy profiles enabled!
Using directly with KubeSpawner
After the package is installed, you can have kubespawner use the templates shipped
with this package to provide appropriate UI, by adding the following snippet
to your jupyterhub_config.py
file:
from jupyterhub_fancy_profiles import setup_ui
setup_ui(c)
The setup_ui
function will setup all the appropriate config as needed. Currently,
it will:
- Setup extra templates to be made available to kubespawner, to render the
base HTML for
profile_list
. - Setup extra HTTP handlers, primarily for serving our static assets.
What is in here?
The primary contents are:
jupyterhub_fancy_profiles/templates
contains jinja2 templates, primarilyHTML
for constructing the form itself. This can contain multiple templates that are composed together using all of jinja2's composition features (likeinclude
)src/
contains JS and CSS that are packaged via standard frontend bundling tools (webpack
andbabel
), outputing assets intojupyterhub_fancy_profiles/static/
. This allows us to use standard frontend tooling to write JS & CSS - for example, xterm.js can be used without many complications.
Why React?
/* If this file gets over 200 lines of code long (not counting docs / comments), start using a framework
(from the BinderHub JS Source Code)
Dear Reader, the file did get more than 200 lines long, but alas there was no time to start using a framework. Lesson learnt from that is we should use a very lightweight framework right from the start, something mainstream that can attract frontend devs without being so fancy that nobody else can work on it. Given the size and complexity of this - a complex UI but only a single page - plain react without typescript seems the correct choice. We will not make this into a super-heavy, complex application - just a fairly simple one that uses react.
Funding
Funded in part by GESIS in cooperation with NFDI4DS 460234259 and CESSDA.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jupyterhub_fancy_profiles-0.3.0.tar.gz
.
File metadata
- Download URL: jupyterhub_fancy_profiles-0.3.0.tar.gz
- Upload date:
- Size: 297.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d639c7c83dd361626786bc3d1b24ee76a2a393a8f27e3cfa5948e7d5f397185 |
|
MD5 | 45fe9b0d956158822232e906f5b68ac8 |
|
BLAKE2b-256 | 084f4a8b908daf2e5c046c11bb96bfb3044b7823c363e22423919c49c875a262 |
File details
Details for the file jupyterhub_fancy_profiles-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: jupyterhub_fancy_profiles-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06bcbaea7d627ff06237af7a3cded894f17ec89db387def7c75345734758c428 |
|
MD5 | 6d3ffe106bc014b09dac87bacd263aa7 |
|
BLAKE2b-256 | ce613ed7860ce88a4f6c89854c0825407af401d4aef2f0811386789126aaa064 |