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.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 jupyterhub-credit-service 0.4.1
File Size Uploaded Provenance Actions
jupyterhub_credit_service-0.4.1.tar.gz 32.2 kB With provenance Details for jupyterhub_credit_service-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 55.0 kB

Release files / jupyterhub_credit_service-0.4.1.tar.gz

Download URL jupyterhub_credit_service-0.4.1.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4bce044202a7a22ad6c108a3718cc2a5aa840837b6bc38441f70cd3d128c8576
BLAKE2b-256 checksum
How to use checksums
88ecfe5768f25e389941afe377b214a2fd86e050b07d0be15aa030847fa7dc26
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 Sep 30, 2026.

Transparency log

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

Download URL jupyterhub_credit_service-0.4.1-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f67ba6bffc5feee4e87859ee13ab0c7fa993fc7ec45e9789092596d0ac47a178
BLAKE2b-256 checksum
How to use checksums
3faaeb445ed5d32323b1c79943f965d0641b111aab93b7f422bb553849ae1da9
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 Sep 30, 2026.

Transparency log

Security for jupyterhub-credit-service 0.4.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.

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.1.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 Sep 30, 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