Skip to main content

CRC JupyterHub Configuration Manager

jh_config_manager is a dynamic configuration manager service for JupyterHub that monitors and updates virtual environment and module configuration information. It writes this information to a cache file for use by custom spawners or UI components.

How It Works

The config manager runs as a background process. It periodically scans a directory containing virtual environments and reads a JSON file describing administrator-managed LMOD modules. When it detects a change in either source, it writes the combined state to a unified cache file, which JupyterHub reads to dynamically populate user-facing spawner options.

The process is designed to run continuously as a JupyterHub service, requiring no manual intervention or restarts to pick up new environments or module configurations.

CLI Options

The background service is configured via the command-line arguments or using environmental variables. Command-line arguments take precedence over environment variables, which in turn take precedence over built-in defaults.

Argument Environment Variable Default Description
-v, --venv_root VENV_ROOT /ihome/crc/install/jupyterhub/hub.5.2.1/envs Path to the root directory containing virtual environments
-m, --modules_config_file MODULES_CONFIG_FILE /ihome/crc/install/jupyterhub/modules_config.json Path to the JSON file describing modules
-c, --cache_file CACHE_FILE /ihome/crc/install/jupyterhub/config_cache.json Path to the output cache file (used by the JupyterHub spawner)
-r, --reload_interval RELOAD_INTERVAL 30 Number of seconds between scans

Installation

This project is available directly from PyPI:

pipx install jh-config-manager

Confirm the CLI command is available in your runtime environment:

jh-config-manager -h

The jh_config_manager utility is intended to run as a managed JupyterHub service rather than a standalone script, so that it starts and stops alongside the Hub and is automatically restarted if it exits unexpectedly. To register it, add an entry to the services list in jupyterhub_config.py, supplying whichever arguments differ from your environment's defaults:

c.JupyterHub.services = [
    {
        'name': 'jh-config-manager',
        'command': [
            'python', '-m', 'jh_config_manager',
            '--venv_root=/ihome/crc/install/jupyterhub/hub.5.2.1/envs',
            '--modules_config_file=/ihome/crc/install/jupyterhub/modules_config.json',
            '--cache_file=/ihome/crc/install/jupyterhub/config_cache.json',
            '--reload_interval=30',
        ],
    },
]

The module configuration file is maintained by administrators and defines the sets of LMOD modules available to users through the spawner UI. Each top-level key identifies a module set and maps to a display name shown to users and a list of modules to load when that set is selected:

{
  "amber24": {
    "display_name": "Amber 2024",
    "modules": [
      "openmpi/4.1.1",
      "amber/24-jupyterhub"
    ]
  },
  "cuda11.2": {
    "display_name": "CUDA 11.2",
    "modules": [
      "cuda/11.2"
    ]
  }
}

The service continuously monitors the virtual environments and module configuration file for changes. Whenever either source changes, it regenerates the cache file in full, combining both into a single document that JupyterHub consults at spawn time. An example output is provided below:

{
  "virtualenvs": [
    "venv1",
    "venv2"
  ],
  "modules": {
    "amber24": {
      "display_name": "Amber 2024",
      "modules": [
        "openmpi/4.1.1",
        "amber/24-jupyterhub"
      ]
    },
    "cuda11.2": {
      "display_name": "CUDA 11.2",
      "modules": [
        "cuda/11.2"
      ]
    }
  }
}

Metadata

Release files for jh-config-manager 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jh-config-manager 1.0.1
File Size Uploaded Provenance
jh_config_manager-1.0.1.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jh-config-manager 1.0.1
File Interpreter ABI Platform
jh_config_manager-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / jh_config_manager-1.0.1.tar.gz

Download URL jh_config_manager-1.0.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c94334a72e125047a4c6811a92244775785ea88c02391d6611d377754cbf5907
BLAKE2b-256 checksum
How to use checksums
13b3cf555dbea238991c14ebac80c3d3bb628427adc2dae9c0b170be9f46d0ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jh_config_manager-1.0.1-py3-none-any.whl

Download URL jh_config_manager-1.0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
200e4156fb4c18fa71c10dafb3e2d80c967be20978589d4994b74752b8470973
BLAKE2b-256 checksum
How to use checksums
ddd9152f48c510f39580cff0dacf7cf5926e4d3969c4e93a67bc6cff43fe775f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for jh-config-manager 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page