Jupyterlab extension to allow file or folder to be dragged-and-dropped to terminal. And to turn into a path. And if the terminal is a python file or not a terminal but python notebook - it would be turned either into path again (default) or to Pathlib expression (depending on the config in the settings)
Project description
jupyterlab_drag_and_drop_path_extension
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
pathlibexpression joined with the/operator (e.g.pathlib.Path('/home/me') / 'data' / 'file.csv') - Drop onto a notebook - the path lands at the active cell's current cursor position
- Absolute or relative paths - configurable; relative is computed against the terminal's working directory or the open document's directory
- Multi-file safety - drags carrying more than one item are ignored
- Master on/off switch - disable the extension without uninstalling
Usage
- Open a target alongside the file browser - a terminal, a Python file, or a notebook
- Drag a single file or folder from the file browser onto the target
- 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 at the active cell's current cursor position. Whether the path is absolute or relative, and how Python output is formatted, is controlled by the settings below.
Settings
Configure under Settings -> Drag and Drop Path:
enabled- master on/off (defaulttrue)pathType-absoluteorrelative(defaultrelative)pythonPathStyle-posixfor a quoted string literal,pathlibfor aPath(...)expression (defaultposix)pathlibConstructor-pathlib.PathorPath, used whenpythonPathStyleispathlib(defaultpathlib.Path)
Requirements
- JupyterLab >= 4.0.0
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyterlab_drag_and_drop_path_extension-0.8.7.tar.gz.
File metadata
- Download URL: jupyterlab_drag_and_drop_path_extension-0.8.7.tar.gz
- Upload date:
- Size: 331.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09276392ae892f1da4961a4623fc1c1768bc827f0d69db09fe26c32204188502
|
|
| MD5 |
6f28c84d9d14dbb2ae3e1d6a6cc5f616
|
|
| BLAKE2b-256 |
94b3eba1e2a63e9ed2b96b8391713b8844b7142db128562f8d2cb9ace7e0dc7e
|
File details
Details for the file jupyterlab_drag_and_drop_path_extension-0.8.7-py3-none-any.whl.
File metadata
- Download URL: jupyterlab_drag_and_drop_path_extension-0.8.7-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
638b229ff3ab9dccb6e64711f31228fe816169f806050f538bdf28c852aa09f7
|
|
| MD5 |
5eabd3ae659133a242f77612792900a4
|
|
| BLAKE2b-256 |
819422b4c72c57b8c129c38751cf3084187a6b6b137ad2b1d89282d86aa78da7
|