guysv/ilua

Passing ipython command line arguments

Closed this issue · 11 comments

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

guysv commented

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

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/

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

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

guysv commented

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.

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.

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

Neither does LUA_INTERPRETER works, as mentioned in:

ilua/ilua/app.py

Lines 17 to 21 in 93fea36

self.parser.add_argument("-i", "--lua-interpreter", metavar="LUA",
default=self._get_default("LUA_INTERPRETER",
'lua'),
help="Lua interpreter to use for code "
"evaluations")

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

guysv commented

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 >_<

$ ILUA_LUA_INTERPRETER=mylua jupyter console --kernel=lua --no-confirm-exit

\o/

Thanks.

guysv commented

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