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.1.tar.gz (8.8 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.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nbstager-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 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.1.tar.gz
Algorithm Hash digest
SHA256 170761ba3f2335d0be6508855a59b1940f4d9072bcca70a356e020140e39c2d0
MD5 3f6dbe6ff75df1227aca62b02002b6dc
BLAKE2b-256 ac8add7dd24d886d02c1474bc4cf3e4cfebdd2e29cd371ded3fe36b42bb86c5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbstager-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: nbstager-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6717d27211f8fc1ba63f7d98d5291154abe85a18ab445b62b510af09b89d5688
MD5 5b361da3c1d64bb1e9c0f9792ee8c15d
BLAKE2b-256 4cb9788f731de8413d139938af739ef184c930856587cba40e9b53d214669c40

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbstager-0.1.1-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