File: jupyter.py

package info (click to toggle)
python-trame-client 3.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,128 kB
  • sloc: python: 9,583; javascript: 3,897; sh: 9; makefile: 6
file content (16 lines) | stat: -rw-r--r-- 343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from IPython.core.getipython import get_ipython
from pathlib import Path


def get_kernel_id():
    kernel = get_ipython().kernel
    conf = kernel.config
    for key in conf:
        if "connection_file" in conf[key]:
            conn = Path(conf[key]["connection_file"])
            return conn.stem[7:]


__ALL__ = [
    "get_kernel_id",
]