ipykernel
ドキュメント追いづらい
これのREADME、ぜんぜん利用者向けのテキストじゃない
ipythonのkernelって何?
従来のREPLを抽象、拡張した概念
プロセスを分離する
これをkernelとよんでいる
何ができる
一つのkernelに複数のclientが接続できる
そもそもipykernelが何をするものなのかが分からない
門外漢であるmiyamonz.iconが普通にgithubのREADMEとドキュメントを見ている
cliのhelpとか、挙動だけで推測する
$ python -m ipykernel install --help
code:txt
Install the IPython kernel spec.
optional arguments:
-h, --help show this help message and exit
--user Install for the current user instead of system-wide
--name NAME Specify a name for the kernelspec. This is needed to
have multiple IPython kernels at the same time.
--display-name DISPLAY_NAME
Specify the display name for the kernelspec. This is
helpful when you have multiple IPython kernels.
--profile PROFILE Specify an IPython profile to load. This can be used
to create custom versions of the kernel.
--prefix PREFIX Specify an install prefix for the kernelspec. This is
needed to install into a non-default location, such as
a conda/virtual-env.
--sys-prefix Install to Python's sys.prefix. Shorthand for --prefix
='/Users/miyamonz/go/src/github.com/miyamonz/ipython-
practice/venv'. For use in conda/virtual-envs.
venvでサクッと環境を作り、その中でpip install ipykernelをしたとする ipykernelのインストール
特定のフォルダにjsonを含めた設定データがフォルダ単位で入るだけ
システムワイドとユーザーワイドがある
$ python -m ipykernel install --name=hogehoge
Installed kernelspec hogehoge in /usr/local/share/jupyter/kernels/hogehoge
$ python -m ipykernel install --user --name=hogehoge
Installed kernelspec hogehoge in /Users/miyamonz/Library/Jupyter/kernels/hogehoge
もしかしたらOSごとにフォルダは微妙に違うかもしれん
installコマンドで作られる出力先のPathにjupyterとあるように、あくまでjupyter向けのkernelを設定する
こういうかんじ
hogehoge/
├── kernel.json
├── logo-32x32.png
└── logo-64x64.png
code:kernel.json
{
"argv": [
"/Users/miyamonz/go/src/github.com/miyamonz/ipython-practice/venv/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "hogehoge",
"language": "python"
}
kernelとして起動したいpythonのパスなどが入っているだけっぽい
また、ipykernel_launcherを起動するらしいが
これはipykernelに入ってるのかな