Using Jupyter.
This commit is contained in:
parent
8a78f9d71d
commit
cdf4c94a2b
|
|
@ -218,9 +218,9 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 2",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python2"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.3"
|
"version": "3.7.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "61944c2e",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Using the Joypy (Thun) Jupyter kernal."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "f7bb85e5",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"41"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"23 18 +"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "8d86c75f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"clear"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "ff9b5754",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"15"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"45 30 gcd"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "e1027ca3",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"clear"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "aef6f509",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"words"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "904ce05e",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"``trace`` is only loaded in the ``pretty_printer.py`` module, so it's not automatically included in the dictionary in the kernel.\n",
|
||||||
|
"\n",
|
||||||
|
"Stdout is also not captured and returned to the notebook. (So ``words`` doesn't work, for example, and neither would ``trace`` if it was available, I imagine.)\n",
|
||||||
|
"\n",
|
||||||
|
"Also, exceptions (like ``trace`` not being found in the dictionary) lead to the kernal \"hanging\" in the sense that you just see the \"pending computation\" asterix in the notebook cell.\n",
|
||||||
|
"\n",
|
||||||
|
"This would seem to indicate that I should polish the Joy kernel, eh?"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "f491e33f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"[1 2 +]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "31d6ec54",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"trace"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "b8a3f442",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Joypy",
|
||||||
|
"language": "",
|
||||||
|
"name": "thun"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"file_extension": ".joy",
|
||||||
|
"mimetype": "text/plain",
|
||||||
|
"name": "Joy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,78 @@ in the `joypy/docs` directory and run the notebooks.
|
||||||
...something about the `notebook_preamble.py` file.
|
...something about the `notebook_preamble.py` file.
|
||||||
|
|
||||||
|
|
||||||
|
## Installing the [Joy Jupyter Kernel](https://osdn.net/projects/joypy/scm/git/Thun/tree/master/docs/jupyter_kernel/)
|
||||||
|
|
||||||
|
[Joy Jupyter Kernel](https://osdn.net/projects/joypy/scm/git/Thun/tree/master/docs/jupyter_kernel/)
|
||||||
|
|
||||||
|
Tracking down the deets:
|
||||||
|
- [Installing Kernels](https://jupyter.readthedocs.io/en/latest/install/kernels.html)
|
||||||
|
- [Kernels](https://jupyter.readthedocs.io/en/latest/projects/kernels.html#kernels-langs)
|
||||||
|
- [Jupyter kernels](https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages)
|
||||||
|
- [Jupyter kernels](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)
|
||||||
|
- [Creating new Jupyter kernels](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels#creating-new-jupyter-kernels)
|
||||||
|
- "[Making kernels for Jupyter](https://jupyter-client.readthedocs.io/en/latest/kernels.html) in the documentation."
|
||||||
|
|
||||||
|
From [Making simple Python wrapper kernels](https://jupyter-client.readthedocs.io/en/latest/wrapperkernels.html):
|
||||||
|
|
||||||
|
> Now create a JSON kernel spec file and install it using
|
||||||
|
``jupyter kernelspec install </path/to/kernel>``.
|
||||||
|
Place your kernel module anywhere Python can import it
|
||||||
|
(try current directory for testing).
|
||||||
|
|
||||||
|
The current list of kernels:
|
||||||
|
|
||||||
|
% jupyter kernelspec list
|
||||||
|
Available kernels:
|
||||||
|
python3 /usr/home/sforman/.local/share/jupyter/kernels/python3
|
||||||
|
|
||||||
|
> Place your kernel module anywhere Python can import it
|
||||||
|
|
||||||
|
Yah, okay.
|
||||||
|
|
||||||
|
sforman@bock:~/src/Joypy/docs/jupyter_kernel % setenv PYTHONPATH `pwd`
|
||||||
|
|
||||||
|
Let's go!
|
||||||
|
|
||||||
|
sforman@bock:~/src/Joypy/docs/jupyter_kernel % jupyter kernelspec install .
|
||||||
|
[Errno 13] Permission denied: '/usr/local/share/jupyter'
|
||||||
|
Perhaps you want to install with `sudo` or `--user`?
|
||||||
|
|
||||||
|
Okay
|
||||||
|
|
||||||
|
sforman@bock:~/src/Joypy/docs/jupyter_kernel % jupyter kernelspec install --user .
|
||||||
|
[InstallKernelSpec] Removing existing kernelspec in /usr/home/sforman/.local/share/jupyter/kernels/.
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/home/sforman/.local/bin/jupyter-kernelspec", line 8, in <module>
|
||||||
|
sys.exit(KernelSpecApp.launch_instance())
|
||||||
|
File "/home/sforman/.local/lib/python3.7/site-packages/traitlets/config/application.py", line 846, in launch_instance
|
||||||
|
app.start()
|
||||||
|
File "/home/sforman/.local/lib/python3.7/site-packages/jupyter_client/kernelspecapp.py", line 323, in start
|
||||||
|
return self.subapp.start()
|
||||||
|
File "/home/sforman/.local/lib/python3.7/site-packages/jupyter_client/kernelspecapp.py", line 151, in start
|
||||||
|
replace=self.replace,
|
||||||
|
File "/home/sforman/.local/lib/python3.7/site-packages/jupyter_client/kernelspec.py", line 404, in install_kernel_spec
|
||||||
|
shutil.rmtree(destination)
|
||||||
|
File "/usr/local/lib/python3.7/shutil.py", line 498, in rmtree
|
||||||
|
onerror(os.rmdir, path, sys.exc_info())
|
||||||
|
File "/usr/local/lib/python3.7/shutil.py", line 496, in rmtree
|
||||||
|
os.rmdir(path)
|
||||||
|
OSError: [Errno 22] Invalid argument: '/usr/home/sforman/.local/share/jupyter/kernels/.'
|
||||||
|
|
||||||
|
__Looks at code__ Oh FFS
|
||||||
|
|
||||||
|
cp -Rv /usr/home/sforman/src/Joypy/docs/jupyter_kernel /usr/home/sforman/.local/share/jupyter/kernels/thun
|
||||||
|
|
||||||
|
/usr/home/sforman/src/Joypy/docs/jupyter_kernel -> /usr/home/sforman/.local/share/jupyter/kernels/thun
|
||||||
|
/usr/home/sforman/src/Joypy/docs/jupyter_kernel/Try out the Joypy Jupyter Kernel.ipynb -> /usr/home/sforman/.local/share/jupyter/kernels/thun/Try out the Joypy Jupyter Kernel.ipynb
|
||||||
|
/usr/home/sforman/src/Joypy/docs/jupyter_kernel/joy_kernel.py -> /usr/home/sforman/.local/share/jupyter/kernels/thun/joy_kernel.py
|
||||||
|
/usr/home/sforman/src/Joypy/docs/jupyter_kernel/kernel.json -> /usr/home/sforman/.local/share/jupyter/kernels/thun/kernel.json
|
||||||
|
|
||||||
|
Done. Can start joy kernal notebooks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue