Skip to main content

JupyterHub Credit Service

Documentation PyPI Test Action PyPI


Overview

The JupyterHub Credit Service is a python package that can be installed as an extension to JupyterHub. It introduces a lightweight, flexible system to limit resource consumption on a per-user and/or per-project model.

It enables administrators to control how long users can use computational environments, and how shared project resources are allocated — all without complex accounting or billing systems.

JupyterHub

Installation

You can install the package directly from PyPI:

pip install jupyterhub-credit-service

Configuration

For detailed information, please visit the documentation site.

Example jupyterhub_config.py:

import jupyterhub_credit_service

# Configure Authenticator
from oauthenticator.generic import GenericOAuthenticator
# Use any Authenticator you usually use together with the CreditsAuthenticator
class MixinAuthenticator(GenericOAuthenticator, jupyterhub_credit_service.CreditsAuthenticator):
    pass

c.JupyterHub.authenticator_class = MixinAuthenticator

# Different users may get different amount of credits or are part of different projects
async def credits_user(user_name, user_groups, is_admin, auth_model):
    ret = {
        "name": "default",
        "cap": 100,
        "grant_value": 10,
        "grant_interval": 600,
        "project": None,
    }
    if is_admin:
        ret["project"] = {
            "name": "admin",
            "cap": 1000,
            "grant_value": 100,
            "grant_interval": 300
        }
    elif "community1" in user_groups:
        ret["project"] = {
            "name": "community1",
            "cap": 100,
            "grant_value": 10,
            "grant_interval": 300
        }
    return ret

c.MixinAuthenticator.credits_user = credits_user  # may be a callable or a dict

c.MixinAuthenticator.userinfo_url = ... # your normal authenticator configuration


# Configure Spawner
import kubespawner
# You can reuse the "KubeSpawner" name so you don't have to change your other configs
class KubeSpawner(kubespawner.KubeSpawner, jupyterhub_credit_service.CreditsSpawner):
    pass

def get_billing_value(spawner):
    # Costs gpus*10 credits + 5 credits, per billing_interval
    billing_value = 5
    if "gpus" in spawner.user_options.keys():
        billing_value += spawner.user_options["gpus"] * 10
    return billing_value

c.JupyterHub.spawner_class = KubeSpawner
c.KubeSpawner.billing_value = get_billing_value # may be a callable or integer
c.KubeSpawner.billing_interval = 600 # may be a callable or integer

# Show JupyterHub Credits in the Header in your frontend
c.JupyterHub.template_paths = jupyterhub_credit_service.template_paths

Metadata

Release files for jupyterhub-credit-service 0.4.2

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

Source distribution (sdist)

Source distribution for jupyterhub-credit-service 0.4.2
File Size Uploaded Provenance Actions
jupyterhub_credit_service-0.4.2.tar.gz 32.2 kB With provenance Details for jupyterhub_credit_service-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jupyterhub-credit-service 0.4.2
File Interpreter ABI Platform Actions
jupyterhub_credit_service-0.4.2-py3-none-any.whl Python 3 none any Details for jupyterhub_credit_service-0.4.2-py3-none-any.whl

Total release size: 55.0 kB

Release files / jupyterhub_credit_service-0.4.2.tar.gz

Download URL jupyterhub_credit_service-0.4.2.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c23eaa35a1972a1e3c59d06759b322d80e5ef2a8afa37b348c38ce51b5518ea1
BLAKE2b-256 checksum
How to use checksums
777f92cdbc75874e6e7c43901eef7cadb2b9bb4ed05b6b9630f0dcbde6f5ed3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / jupyterhub_credit_service-0.4.2-py3-none-any.whl

Download URL jupyterhub_credit_service-0.4.2-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49809f7a605f418c8d4c7adc5afc9049e0e33355733aa0ad02ca16afa02e24ca
BLAKE2b-256 checksum
How to use checksums
58dcb311aabdb4693b5a82eca16131ba051cb9d879a1b04041866ebd1a0cc720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for jupyterhub-credit-service 0.4.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jupyterhub_credit_service-0.4.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

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