Metadata-Version: 2.4
Name: spyder-copy-current
Version: 0.1.0
Summary: Spyder plugin to copy the current file path and kernel connection info
Home-page: https://github.com/hruskamiro/spyder-copy-current
Author: Miroslav Hruska
Author-email: hruska.miro@gmail.com
License: MIT
Project-URL: Source, https://github.com/hruskamiro/spyder-copy-current
Project-URL: Issues, https://github.com/hruskamiro/spyder-copy-current/issues
Keywords: spyder,plugin,ipython,jupyter,clipboard,kernel
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: IPython
Classifier: Framework :: Jupyter
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jupyter_client<9,>=7.4.9
Requires-Dist: spyder<7,>=5.4
Requires-Dist: qtpy
Dynamic: license-file

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

```bash
pip install spyder-copy-current
```

Or install directly from GitHub:

```bash
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.
