Skip to main content

jupyterlab_drag_and_drop_path_extension

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

Drag a file or folder from the file browser and drop it onto a terminal, Python file, or notebook to insert its path - no copy-pasting, no typing.

Features

  • Drop onto a terminal - inserts the path as a shell-escaped argument and brings the terminal tab to the foreground
  • Drop onto a Python file or notebook code cell - inserts a quoted string literal, or a pathlib expression joined with the / operator (e.g. pathlib.Path('/home/me') / 'data' / 'file.csv')
  • Drop onto any other file - markdown, text, JSON and the rest receive the bare path, with no quoting
  • Absolute or relative paths - configurable; relative is computed against the terminal's working directory or the open document's directory
  • Master on/off switch - disable the extension without uninstalling

Usage

  1. Open a target alongside the file browser - a terminal, a Python file, or a notebook
  2. Drag a single file or folder from the file browser onto the target
  3. The path is inserted - shell-escaped in terminals, as a quoted string or a pathlib.Path(...) expression in Python contexts, or as plain text elsewhere

In notebooks the path lands in the cell you drop it on, at that cell's cursor position; a drop away from any cell goes to the active cell. One file or folder at a time: a drag carrying several items is refused and the cursor shows no-drop. Whether the path is absolute or relative, and how Python output is formatted, is controlled by the settings below.

Settings

Open Settings → Settings Editor → Drag and Drop Path. Each entry below leads with the label the editor shows, with the JSON key in brackets for anyone editing the raw settings:

  • Enable drag-and-drop path insertion (enabled) - master on/off, default on
  • Path type (pathType) - relative (default) or absolute
  • Python path style (pythonPathStyle) - posix inserts a quoted string literal (default), pathlib inserts a Path(...) expression
  • Pathlib constructor (pathlibConstructor) - pathlib.Path (default) or Path; choose Path only in files that already do from pathlib import Path, because the extension inserts no import

Requirements

  • JupyterLab >= 4.0.0
  • The wheel also installs and auto-enables a jupyter_server extension, which supplies the server root and each terminal's working directory
  • Relative paths in a terminal need that server extension and a readable process table - /proc on Linux, lsof on macOS. Where it is unavailable the extension inserts nothing rather than a wrong path; absolute paths and all editor and notebook drops are unaffected

Install

To install the extension, execute:

pip install jupyterlab_drag_and_drop_path_extension

Uninstall

To remove the extension, execute:

pip uninstall jupyterlab_drag_and_drop_path_extension

Acknowledgements

Thanks to Paul Romer for the inspiration and the discussions about reducing user friction when working with hierarchical folder structures in JupyterLab.

Metadata

Release files for jupyterlab-drag-and-drop-path-extension 1.0.3

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

Source distribution (sdist)

Source distribution for jupyterlab-drag-and-drop-path-extension 1.0.3
File Size Uploaded
jupyterlab_drag_and_drop_path_extension-1.0.3.tar.gz 197.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterlab-drag-and-drop-path-extension 1.0.3
File Interpreter ABI Platform
jupyterlab_drag_and_drop_path_extension-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 228.4 kB

Release files / jupyterlab_drag_and_drop_path_extension-1.0.3.tar.gz

Download URL jupyterlab_drag_and_drop_path_extension-1.0.3.tar.gz
Size 197.2 kB
Tags Source
SHA-256 checksum
How to use checksums
65d8f682d66256f614d4ddbc26453aa8e7aaf741f7d4de48f794de8ab72a2462
BLAKE2b-256 checksum
How to use checksums
a827a40bd7170588e3358a38f4e738d9d86b6f8cf7ff8517211adeb22352133f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / jupyterlab_drag_and_drop_path_extension-1.0.3-py3-none-any.whl

Download URL jupyterlab_drag_and_drop_path_extension-1.0.3-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc99db4449874e834026023ac6be70ebcc4e53a096924598e9c50768d98ec0a0
BLAKE2b-256 checksum
How to use checksums
1115b4d911b655c9719ae85997c57ea34f29a60a5b33ab9be10cb2a05b6447d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

This release

1.0.3 This release

2 release files

1.0.2

2 release files

0.8.7

2 release files

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