Let’s say you’re inside a jupyter notebook.
How do you find the URL of the current page?
This should be equivalent to if you just did the following in the javascript console:
window.location.href
// this assumes you know you’re in IJulia
Let’s say you’re inside a jupyter notebook.
How do you find the URL of the current page?
This should be equivalent to if you just did the following in the javascript console:
window.location.href
// this assumes you know you’re in IJulia
Even getting the name of the notebook is tricky and undocumented:
https://github.com/jupyter/notebook/issues/1000
Once you have the name, I think you can use the contents of IJulia.connection_file
to work out the URL.
So, I’m still a little stumped at how that information would get you to a full url.
in julia,
> readlines(open(IJulia.connection_file))
12-element Array{String,1}:
"{"
" \"shell_port\": 45415,"
" \"iopub_port\": 56344,"
" \"stdin_port\": 55505,"
" \"control_port\": 34104,"
" \"hb_port\": 55104,"
" \"ip\": \"127.0.0.1\","
" \"key\": \"8f542a78-191098430b8bad7b07401613\","
" \"transport\": \"tcp\","
" \"signature_scheme\": \"hmac-sha256\","
" \"kernel_name\": \"julia-0.6\""
"}"
in python,
> get_notebook_name()
/home/jovyan/Carthage.jl.ipynb
With the following found in the process:
{'base_url': '/user/djsegal-carthage-binder-9195qzmy/', 'hostname': '0.0.0.0', 'notebook_dir': '/home/jovyan', 'password': False, 'pid': 1, 'port': 8888, 'secure': False, 'token': 'j03TaCw7Qoun35S4-dCtjQ', 'url': 'http://0.0.0.0:8888/user/djsegal-carthage-binder-9195qzmy/'}
{'id': 'f10cccfe-449b-4f75-a91c-997ed9cc6952', 'path': 'Carthage.jl.ipynb', 'name': '', 'type': 'notebook', 'kernel': {'id': '38a072d1-ceed-4874-aa37-8da41a659dd4', 'name': 'python3', 'last_activity': '2018-03-21T18:06:35.476223Z', 'execution_state': 'busy', 'connections': 1}, 'notebook': {'path': 'Carthage.jl.ipynb', 'name': ''}}
Do you know any other puzzle pieces that might exist?
Or maybe more importantly, how do you get this python function in Julia:
> list_running_servers
Look at its implementation in Python. It basically walks the Jupyter runtime directory. To get the runtime directory, see here.
All straightforward stuff to re-implement in Julia, just needs someone to do it.