Skip to content

Support nested profile_options in profile choices - #928

Open
rtmiz wants to merge 8 commits into
jupyterhub:mainfrom
rtmiz:nested-profile-options
Open

Support nested profile_options in profile choices#928
rtmiz wants to merge 8 commits into
jupyterhub:mainfrom
rtmiz:nested-profile-options

Conversation

@rtmiz

@rtmiz rtmiz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What this adds

profile_options choices can now declare their own profile_options, recursively.
This enables dependent option flows in the spawn form — e.g. a "GPU type" dropdown
that only exists while the "GPU" choice is selected:

c.KubeSpawner.profile_list = [
    {
        "display_name": "Demo",
        "profile_options": {
            "gpu": {
                "display_name": "GPU setup",
                "choices": {
                    "none": {"display_name": "No GPU", "default": True, "kubespawner_override": {}},
                    "nvidia": {
                        "display_name": "NVIDIA",
                        "kubespawner_override": {"extra_resource_limits": {"nvidia.com/gpu": "1"}},
                        "profile_options": {
                            "type": {
                                "display_name": "GPU type",
                                "choices": {
                                    "t4":   {"display_name": "T4", "default": True,
                                             "kubespawner_override": {"node_selector": {"gpu": "t4"}}},
                                    "a100": {"display_name": "A100",
                                             "kubespawner_override": {"node_selector": {"gpu": "a100"}}},
                                },
                            },
                        },
                    },
                },
            },
        },
    },
]
image

Nesting works to arbitrary depth, and unlisted_choice (including
validation_regex and {value} templating) works at every level.

Native implementation of 2i2c-org/jupyterhub-fancy-profiles#148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant