Skip to main content

Jupyter Server extension for staging notebook workspaces from repositories, parameters, and data URLs.

Project description

NBStager

NBStager is a Jupyter Server extension for preparing notebook workspaces from launch URLs.

It can:

  • write launch parameters into a .env file;
  • stage data files from HTTP(S) URLs;
  • redirect to a notebook in JupyterLab.

NBStager is designed to work in Binder, JupyterHub, and local JupyterLab environments.

Install

From PyPI, once published:

pip install nbstager

From GitHub:

pip install git+https://github.com/recap/nbstager.git@v0.1.0

For development:

pip install -e .

The package includes a Jupyter Server config file that enables the extension automatically. If needed, enable it manually:

jupyter server extension enable --py nbstager --sys-prefix

Check:

jupyter server extension list

Endpoint

NBStager registers this route:

/launch

Example local URL:

http://localhost:8888/launch?notebookpath=mynotebook.ipynb&DATASET_URL=https://example.org/data.csv

Reserved query parameters

Parameter Required Default Description
notebookpath no Notebook path relative to the target repository root.
data no JSON object or array describing data files to download.

All other query parameters are written to .env.

Passing notebook parameters

/launch?notebookpath=mynotebook.ipynb&DATASET_URL=https://example.org/data.csv

creates:

DATASET_URL=https://example.org/data.csv

inside:

.env

Python notebooks can read it with:

from dotenv import load_dotenv
import os

load_dotenv('.env')
print(os.getenv('DATASET_URL'))

R notebooks can read it with:

library(dotenv)
load_dot_env('.env')
Sys.getenv('DATASET_URL')

Data staging

The data parameter accepts JSON.

Decoded example:

[
  {
    "url": "https://example.org/customers.csv",
    "path": "data/customers.csv"
  }
]

NBStager downloads the files into the workspace and writes:

data_manifest.json

Binder usage

In Binder, install NBStager in your requirements.txt. Then launch a target repository through the wrapper with:

https://mybinder.org/v2/gh/OWNER/WRAPPER_REPO/main?urlpath=launch?notebookpath=mynotebook.ipynb&DATASET_URL=https://example.org/data.csv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbstager-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbstager-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file nbstager-0.1.0.tar.gz.

File metadata

  • Download URL: nbstager-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nbstager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 150fc74a05d13ca177f0b1b50f8728d2855fdf83806f642fc0ae7f8a5d456d68
MD5 80de37ad6473db9e8e8e6b3b30c4a98f
BLAKE2b-256 44b6e28ddffd06bc1532000e0eb462c4815efc49008245d30ba5533dd136b532

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbstager-0.1.0.tar.gz:

Publisher: publish_pypi.yml on recap/nbstager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbstager-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nbstager-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nbstager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06fe420588bcf89aabe2dc9f8dc535617f8e57dda1ce5cc3dd3c8ea10c38bd83
MD5 9a58ddc5ac54e6a00fb0a4e748a28194
BLAKE2b-256 388d28aab0789a1ce513140f96036bf1f5c195f3bcb13fae2d1f58c5221d348f

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbstager-0.1.0-py3-none-any.whl:

Publisher: publish_pypi.yml on recap/nbstager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page