guysv / ilua

Portable Lua kernel for Jupyter
GNU General Public License v2.0
115 stars 11 forks source link

Passing ipython command line arguments #9

Closed hroncok closed 4 years ago

hroncok commented 4 years ago

Is there a way to start ilua with some arguments, such as ilua --no-confirm-exit --no-banner?

guysv commented 4 years ago

Looks like this requires a trivial patch in consoleapp.py that will forward excess arguments to the jupyter frontend.

I'll see what I can do.

guysv commented 4 years ago

ooh, by the way, you can fire up ilua via jupyter-console's entry point jupyter console --kernel=ilua. That way you'll also get access to ipython's tweaking options.

https://jupyter-console.readthedocs.io/en/latest/

hroncok commented 4 years ago

I get jupyter_client.kernelspec.NoSuchKernel: No such kernel named ilua.

With lua I get it working, but I cannot specify my custom interpreter :(

guysv commented 4 years ago

Hmm, I kinda hoped you could. but I couldn't remember exactly :(

guysv commented 4 years ago

Wait, ilua also takes parameters from environment variables. ILUA_INTERPRETER=mylua ilua equals ilua -i mylua if you ILUA_INTERPRETER=mylua jupyter-console -kernel lua, then jupyter will export the right variables to the child.

hroncok commented 4 years ago
ILUA_INTERPRETER=mylua jupyter console --kernel=lua --no-confirm-exit

Get's the job done. --no-banner is not recognized by jupyter console, but I can live with that. Thanks.

hroncok commented 4 years ago

Oh, sorry. It doesn't really use mylua.

hroncok commented 4 years ago

Neither does LUA_INTERPRETER works, as mentioned in:

https://github.com/guysv/ilua/blob/93fea36c3340b530e80b70bfc30957ce1d7e7798/ilua/app.py#L17-L21

Maybe because this code is not used when jupyter console --kernel=lua starts?

guysv commented 4 years ago

hmm, it should be used, according to kernel.json https://github.com/guysv/ilua/blob/master/defaultspec/kernel.json

I misled you, the correct variable is ILUA_LUA_INTERPRETER I should've documented that >_<

hroncok commented 4 years ago
$ ILUA_LUA_INTERPRETER=mylua jupyter console --kernel=lua --no-confirm-exit

\o/

Thanks.

guysv commented 4 years ago

Aight, looks like a good workaround. I'll close this for now.