Skip to main content

spyder-copy-current

Small Spyder plugin that copies the current editor file path and the active IPython kernel connection info to the clipboard.

Default shortcuts:

  • Ctrl+Alt+C: copy the current file path; press twice for {"path": "<path>", "cell": "<cell>"}; press three times for {"path": "<path>", "cell": "<cell>", "line": <line>}
  • Ctrl+Alt+K: copy the active IPython kernel connection info

Supported Versions

  • Spyder 5.4.x through 6.x
  • Python 3.8+

Behavior

  • Copies the current file path to the system clipboard.
  • Copies {"path": "<path>", "cell": "<cell>"} on the second quick press, and {"path": "<path>", "cell": "<cell>", "line": <line>} on the third quick press.
  • Copies the current IPython kernel connection info to the system clipboard.
  • Works from the active editor.
  • Works from the active IPython console for kernel connection info.
  • If the current tab has not been saved yet, it shows a message instead of copying anything.
  • If the current IPython console does not expose kernel connection info, it shows a message instead of copying anything.

Install

Inside the same environment where Spyder runs:

Install the latest released version from PyPI:

pip install spyder-copy-current

Or install directly from GitHub:

pip install "git+https://github.com/hruskamiro/spyder-copy-current.git@main"

Then restart Spyder.

Compatibility Notes

  • The plugin is intended for Spyder 5.4.x through 6.x.
  • Existing user-defined Spyder shortcuts are preserved.
  • The default shortcuts are only assigned if the corresponding Spyder shortcut entry is still empty.

Usage

  • Press Ctrl+Alt+C in the editor to copy the current file path. Press it twice in quick succession to copy {"path": "<path>", "cell": "<cell>"}; press it three times to include the cursor line number.
  • Press Ctrl+Alt+K in the IPython console to copy the current kernel connection info.

The kernel connection info is copied in a %connect_info-style format so it can be reused with Jupyter clients when available.

Shortcut

The plugin registers a keyboard shortcut in Spyder's shortcuts preferences under the editor context. If that shortcut is still empty, it assigns Ctrl+Alt+C by default. Repeating it quickly adds the nearest cell marker, then the cursor line number. It also registers a keyboard shortcut in the IPython console context and assigns Ctrl+Alt+K by default if that shortcut is still empty.

Download files

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

Source Distribution

spyder_copy_current-0.1.0.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

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

spyder_copy_current-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file spyder_copy_current-0.1.0.tar.gz.

File metadata

  • Download URL: spyder_copy_current-0.1.0.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for spyder_copy_current-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2593421435de082fe704a3f3c3f149ba7dfc52a6a1bc3b41cb72805326b7ad5
MD5 b1f246fb80ae72f67d93a2b229ece06d
BLAKE2b-256 af91d7e272a3fcc6737c9b2d0d8ac616ea5ef046e11d5abd8a1f3aac1ce2689a

See more details on using hashes here.

File details

Details for the file spyder_copy_current-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spyder_copy_current-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fffc68963072aeb6acd5cc518d60eaa752b194301b1837c38800aea18669c22
MD5 c28d6f4cc65868b9776d5d8eb40a160e
BLAKE2b-256 e5eb59a03776c5ca0003717139fce0e04911a98dd280635c2909a1e865f53064

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 Sentry Error logging StatusPage Status page