Skip to main content

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

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 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

  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 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 (default true)
  • pathType - absolute or relative (default relative)
  • pythonPathStyle - posix for a quoted string literal, pathlib for a Path(...) expression (default posix)
  • pathlibConstructor - pathlib.Path or Path, used when pythonPathStyle is pathlib (default pathlib.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


Download files

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

Source Distribution

jupyterlab_drag_and_drop_path_extension-0.8.7.tar.gz (331.6 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_drag_and_drop_path_extension-0.8.7.tar.gz.

File metadata

File hashes

Hashes for jupyterlab_drag_and_drop_path_extension-0.8.7.tar.gz
Algorithm Hash digest
SHA256 09276392ae892f1da4961a4623fc1c1768bc827f0d69db09fe26c32204188502
MD5 6f28c84d9d14dbb2ae3e1d6a6cc5f616
BLAKE2b-256 94b3eba1e2a63e9ed2b96b8391713b8844b7142db128562f8d2cb9ace7e0dc7e

See more details on using hashes here.

File details

Details for the file jupyterlab_drag_and_drop_path_extension-0.8.7-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_drag_and_drop_path_extension-0.8.7-py3-none-any.whl
Algorithm Hash digest
SHA256 638b229ff3ab9dccb6e64711f31228fe816169f806050f538bdf28c852aa09f7
MD5 5eabd3ae659133a242f77612792900a4
BLAKE2b-256 819422b4c72c57b8c129c38751cf3084187a6b6b137ad2b1d89282d86aa78da7

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