Skip to main content

Peer-to-peer file sharing for JupyterLab - create named shares (drops) or requests (inboxes), get a link, share it. Files served directly from your server; recipients can use a JupyterLab panel or a plain browser.

Project description

jupyterlab_share_files_extension

GitHub Actions npm version PyPI version Total PyPI downloads JupyterLab 4 Brought To You By KOLOMOLO Donate PayPal

Peer-to-peer file sharing for JupyterLab. Create a share (file drop) or request (inbox) from a side panel, copy the link, paste it in chat - recipients open it in their own JupyterLab panel or any plain browser.

Features

  • Shares - read-only drops of files and folders; recipients download
  • Requests - inboxes; recipients upload, organised per uploader
  • Connections - paste someone's link to subscribe to their share or upload to their request
  • Drag-and-drop from the file browser - drop zone (new share), share row (add files), request row (upload)
  • Browse inside a share - double-click a folder to drill in; the .. row goes back up
  • Open files directly - double-click a file in the panel, JupyterLab opens it with the right viewer
  • Copy/paste between the panel and the file browser
  • Right-click context menu - in the file browser ("Share Files...") and on panel rows ("Copy to Current Folder", "Show in File Browser")
  • Hidden files visible by default - dotfiles like .env, .gitignore are shareable; toggle in Settings
  • Standalone HTML page - link works in any browser, no JupyterLab needed
  • QR code in the share-link dialog for scanning from a phone
  • Live upload notifications when someone uploads to your request
  • Self-connect guard - pasting your own link shows a "you already own this" dialog
  • Symlink-friendly - sharing @shared/... and similar works
  • Delete to trash - panel deletes go to the OS trash by default (c.ShareFilesConfig.use_trash)
  • HTTPS-aware links - share URLs follow the scheme the browser is on
  • Cloudflare tunnel sharing - optional: links carry a public Cloudflare hostname, usable outside your network; a cloud icon in the panel header shows when active (docs/cloudflare_setup.md)
  • Settings toggles - shares, requests, hidden-file visibility, poll interval

Requirements

  • JupyterLab >= 4.0.0
  • Python >= 3.9

Install

Developers (project Makefile):

make install

End-users (PyPI):

pip install jupyterlab_share_files_extension

Configuration

Optional, in jupyter_server_config.py:

c.ShareFilesConfig.shares_dir = "uploads"        # default - relative to the notebook root
c.ShareFilesConfig.use_trash = True              # default: True
c.ShareFilesConfig.verify_peer_tls = True        # default: True
  • shares_dir - where shares/requests/connections are stored; relative paths resolve against the notebook root (the server's root_dir), created on demand
    Must resolve inside the notebook root - the extension refuses to start with a StorageError otherwise (shares outside the root are unreachable from the file browser and Contents API)
  • use_trash - False deletes permanently instead of moving to the OS trash
  • verify_peer_tls - set False when peers (e.g. a JupyterHub) use a self-signed certificate; server-side saves/uploads to such peers otherwise fail with a 502
  • pollIntervalSeconds - panel refresh interval, in Settings Editor under Share Files (default 15, minimum 2); one tick refreshes all shares, requests and connections

CLI

jupyterlab_share_files - the panel's operations as subcommands. A thin client over the same authenticated HTTP API the panel uses, acting as one user via that user's Jupyter/JupyterHub token; scripts and AI agents drive the extension with it. Output is human-readable by default; --json switches to machine-readable JSON.

Environment variables:

  • SHARE_FILES_BASE_URL - base URL of the Jupyter server running the extension
    On JupyterHub this must be the public user URL (e.g. https://hub.example.com/user/<name>/) so generated links carry the public host; falls back to JUPYTER_SERVER_URL (internal on JupyterHub - links would not be shareable)
  • SHARE_FILES_TOKEN - Jupyter or JupyterHub API token; falls back to JUPYTERHUB_API_TOKEN / JUPYTER_TOKEN
  • SHARE_FILES_INSECURE - 1 skips TLS verification (self-signed hub certificates); off by default
jupyterlab_share_files list-items
jupyterlab_share_files create-share <name> [paths...]
jupyterlab_share_files create-request <name>
jupyterlab_share_files connect <link>
jupyterlab_share_files disconnect <key>
jupyterlab_share_files close-share <id>
jupyterlab_share_files close-request <id>
jupyterlab_share_files pick-up <key> [names...] [--target-dir DIR]
jupyterlab_share_files send-to-request <key> <paths...> [--uploader NAME]
jupyterlab_share_files list-request-uploads <id>

Cloudflare tunnel sharing

The cloudflare command exposes share/request links beyond the hub or local network through a Cloudflare tunnel. Four orthogonal subcommands cover the lifecycle; cloudflare --help carries the full reference with examples. Policy and configuration guide: docs/cloudflare_setup.md.

  • setup --token <T> --account-id <A> --hostname <H> --local-base-url <URL> - save credentials (chmod-600 config file) and provision end to end: create/reuse the share-files tunnel, route the hostname to the server URL, add a proxied CNAME, enforce HTTPS, save public_base_url, start the connector daemon
    --local-base-url is required - the URL the cloudflared connector reaches the server at; explicit, never inferred; must be https (error with guidance otherwise; localhost is fine if served over https)
  • validate - end-to-end check of the saved config: token validity (user-owned and account-owned cfat_ tokens), bind capability (list tunnels), create capability - proven by creating a test tunnel and removing it
  • info - current configuration; tokens masked to their last 4 characters, account id in full, daemon_running (cloudflared process) and tunnel_status (Cloudflare-side)
  • reset - reset the saved token to none (clears account id, tunnel state, public_base_url); links revert to the local/hub address on the next request; Cloudflare-side resources untouched

The connector daemon is guaranteed by the extension: at server startup (and after setup) it makes sure cloudflared tunnel run is running, retrying up to c.ShareFilesConfig.cloudflared_retries times (default 3); all attempts failing is logged as an error, success as info.

How links change: the server reads public_base_url per request (no restart needed) and rewrites only the scheme+host of generated links - the path stays auto-detected from the server's own base URL. Without Cloudflare config, links keep the old behaviour (the host the browser is on).

What is exposed: only the extension's unauthenticated /public/... endpoints pass through the tunnel; the hub login, authenticated API and the rest of the private network answer 404 at the Cloudflare edge. Plain http to the share hostname is 301-redirected to https.

Token policies required: Account → Cloudflare Tunnel → Edit and zone-scoped DNS → Edit for the hostname's domain.

jupyterlab_share_files cloudflare setup --token <api-token> --account-id <account-id> \
  --hostname share.example.com --local-base-url "https://hub.example.com/user/<name>/"
jupyterlab_share_files cloudflare validate
jupyterlab_share_files cloudflare info
jupyterlab_share_files cloudflare reset

Security

  • The link is the credential (40 bits of entropy); no expiry, no PIN - share over trusted channels (Slack, email)
  • HTTPS is inherited from your JupyterHub/Jupyter proxy
  • With Cloudflare sharing active, links are reachable from the whole internet - HTTPS only, and only the /public/... capability endpoints; everything else stays unreachable

Uninstall

pip uninstall jupyterlab_share_files_extension

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

jupyterlab_share_files_extension-1.2.2.tar.gz (316.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file jupyterlab_share_files_extension-1.2.2.tar.gz.

File metadata

File hashes

Hashes for jupyterlab_share_files_extension-1.2.2.tar.gz
Algorithm Hash digest
SHA256 9c7af3179d26b6c3a6ffb4dbdf214b308280a21b63a711a64c8ec59f63118bca
MD5 2dfdcf680386ead29ce7ca3e5a2cbbc2
BLAKE2b-256 84045a394b1b24a952086898e084a0c1c39258ade36bc1b918f470d69b29689b

See more details on using hashes here.

File details

Details for the file jupyterlab_share_files_extension-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_share_files_extension-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b96c3d8481befa3173bc9bc9578024cf982b70af8d56ce3806c371b9e1f4848
MD5 b5c864019d1c2987ec398c8e5f12da71
BLAKE2b-256 0874f132fbeb7dadea0fa3111604f871fc204fb213e130ae53a2af10404aea9a

See more details on using hashes here.

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