This is very simple implementation with a lot of known and hidden gems issues:
- autocomplete works correctly only in one-string cell. If someone knows how
console.completion_handler()
works please let me know - when output is long enough and not finished by
...
then next code snippet can get output from this long output print()
output can be found instdout
of tarantool instance. If you need to get value of some variable or even function - just type it in new code cell and pressRun
You can use preconfigured docker image of tarantool
docker run -e TNT_ADDRESS='0.0.0.0' -p 3312:3312 -p 3301:3301 -e TNT_CONSOLE_PORT='3301' -e TNT_SOCKET_PORT=3312 --rm zaraysky/tntrepo:tntsocketserver
If you want to use local tarantool, you can run it using command
tarantool config.lua
The source code of config.lua
is:
box.cfg{listen=os.getenv('TNT_CONSOLE_PORT') or 3301}
local IP = os.getenv('TNT_ADDRESS') or '127.0.0.1'
local PORT = os.getenv('TNT_SOCKET_PORT') or '3312'
box.schema.user.grant('guest', 'read, write, execute', 'universe', nil, {if_not_exists=true})
require('console').listen(IP .. ':' .. PORT)
Run this command in tarantool's console (REPL):
require('console').listen('127.0.0.1:3312')
Please note if you have the previous version of the kernel installed you have to uninstall it using
jupyter kernelspec uninstall tntkernel
mkdir jupyter
cd jupyter
python3 -m venv venv
source venv/bin/activate
pip install jupyter tarantool
# clone it from GitHub to tntkernel folder
git clone git@github.com:zaraysky/tntkernel.git
jupyter kernelspec install tntkernel
Just run
jupyter notebook