Lua IPython Kernel

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua IPython Kernel

Luiz Henrique de Figueiredo
Today I saw a nice demo using IPython <http://ipython.org/>.

IPython is actually language-agnostic and that made me wonder how
feasible it'd be to add a Lua backend.

I found one at <https://github.com/neomantra/lua_ipython_kernel>
but it has been abandoned.

Is there any other effort on a Lua kernel for IPython or should I try to
fork neomantra's code? If anyone else is interested in doing that, it'd
be great too!

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Dirk Laurie-2
2014-08-28 3:23 GMT+02:00 Luiz Henrique de Figueiredo <[hidden email]>:
> Today I saw a nice demo using IPython <http://ipython.org/>.
>
> IPython is actually language-agnostic and that made me wonder how
> feasible it'd be to add a Lua backend.
>It is intended to be a fully compatible
replacement for the standard Python interpreter, while offering vastly
improved functionality and flexibility.
> I found one at <https://github.com/neomantra/lua_ipython_kernel>
> but it has been abandoned.
>
> Is there any other effort on a Lua kernel for IPython or should I try to
> fork neomantra's code? If anyone else is interested in doing that, it'd
> be great too!

I have mixed feelings about this.

Pro: It would be great to have something that can descriibe itself thus:

   It is intended to be a fully compatible replacement for the standard
   Lua interpreter, while offering vastly improved functionality and
flexibility.

Neutral: It is already possible to run ipython-notebook and type
'%%script lua". That gives you the standard Lua interpreter running
in a cell on your browser. You can edit your code there and re-run it.
You have access to all of IPython's ability to store and later resume
sessions. All that a Lua backend will buy you is to make Lua the
default language and allow inter-cell communication.

Neutral: Some of IPython's convenience comes from Python
conventions we do not yet have in Lua, in particular its docstring.

Con: IPython depends on a huge infrastructure. You can see some of
   the iceberg by trying to install IPython 2.2 on a Linux 14.04 system.
   I failed.

If the Lua kernel you envisage can run on IPython 1.2.1 (which is what
I have) I'm willing to be an alpha tester.

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Coroutines
On Wed, Aug 27, 2014 at 11:53 PM, Dirk Laurie <[hidden email]> wrote:

> Neutral: Some of IPython's convenience comes from Python
> conventions we do not yet have in Lua, in particular its docstring.

hmm.

docstring = function (f, description) docstring_table[f] = description end

debug.setmetatable(function () end, { __tostring = function (self)
return rawstring(self), docstring_table[self] end }) -- or something
fun...

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Dirk Laurie-2
2014-08-28 8:58 GMT+02:00 Coroutines <[hidden email]>:

> On Wed, Aug 27, 2014 at 11:53 PM, Dirk Laurie <[hidden email]> wrote:
>
>> Neutral: Some of IPython's convenience comes from Python
>> conventions we do not yet have in Lua, in particular its docstring.
>
> hmm.
>
> docstring = function (f, description) docstring_table[f] = description end
>
> debug.setmetatable(function () end, { __tostring = function (self)
> return rawstring(self), docstring_table[self] end }) -- or something
> fun...

Or less intrusively: 'luarocks install ihelp".

The point is that we don't have a generally accepted style of coding
Lua so that the documentation can be extracted from the source.
LDoc comes closest, but its sigils annoy me,

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

steve donovan
On Thu, Aug 28, 2014 at 9:35 AM, Dirk Laurie <[hidden email]> wrote:
> LDoc comes closest, but its sigils annoy me,

Believe me, they annoy me too ;)

There is an experimental 'colon' mode in ldoc, e.g.

https://github.com/stevedonovan/LDoc/blob/master/tests/styles/colon.lua

--- first useless function.
-- Optional type specifiers are allowed in this format.
-- As an extension, '?T' is short for '?nil|T'.
-- Note how these types are rendered!
-- string: name
-- int: age
-- ?person3: options
-- treturn: ?table|string
function one (name,age,options)
end

So, less @ signs.

Of course, LDoc only really requires that the first comment has at
least three dashes, and the first sentence is treated as the summary.
 E.g. how the Lua standard functions are marked up (I inherited these
files from mitchel's Textadept project):

https://github.com/stevedonovan/LDoc/blob/master/ldoc/builtin/math.lua

It is possible to write scripts that extract these summaries and
function names from the internal representation.

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Lucas Hermann Negri
Speaking of notebook interfaces, there is an initial effort to have a
Lua backend for the Cantor [1] software, from KDE, that provides a
notebook-like interface for different backends. It provides highlight
and code completion, but no 'docstrings' yet.

It was released with KDE 4.14.

[1]: http://oproj.tuxfamily.org/math/lua/kde/2014/08/04/cantor.html

On Thu, Aug 28, 2014 at 5:28 AM, steve donovan
<[hidden email]> wrote:

> On Thu, Aug 28, 2014 at 9:35 AM, Dirk Laurie <[hidden email]> wrote:
>> LDoc comes closest, but its sigils annoy me,
>
> Believe me, they annoy me too ;)
>
> There is an experimental 'colon' mode in ldoc, e.g.
>
> https://github.com/stevedonovan/LDoc/blob/master/tests/styles/colon.lua
>
> --- first useless function.
> -- Optional type specifiers are allowed in this format.
> -- As an extension, '?T' is short for '?nil|T'.
> -- Note how these types are rendered!
> -- string: name
> -- int: age
> -- ?person3: options
> -- treturn: ?table|string
> function one (name,age,options)
> end
>
> So, less @ signs.
>
> Of course, LDoc only really requires that the first comment has at
> least three dashes, and the first sentence is treated as the summary.
>  E.g. how the Lua standard functions are marked up (I inherited these
> files from mitchel's Textadept project):
>
> https://github.com/stevedonovan/LDoc/blob/master/ldoc/builtin/math.lua
>
> It is possible to write scripts that extract these summaries and
> function names from the internal representation.
>
> steve d.
>



--
http://oproj.tuxfamily.org

Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Philipp Janda
In reply to this post by Coroutines
Am 28.08.2014 um 08:58 schröbte Coroutines:

> On Wed, Aug 27, 2014 at 11:53 PM, Dirk Laurie <[hidden email]> wrote:
>
>> Neutral: Some of IPython's convenience comes from Python
>> conventions we do not yet have in Lua, in particular its docstring.
>
> hmm.
>
> docstring = function (f, description) docstring_table[f] = description end
>
> debug.setmetatable(function () end, { __tostring = function (self)
> return rawstring(self), docstring_table[self] end }) -- or something
> fun...
>

If it's docstrings you want, there is nicer syntax for that here[1]. I
have an implementation (mainly for typechecking)[2], and I also have
started to document Lua's standard library[3] for interactive help but
got bored -- I don't use the REPL very often. At least all function
signatures should be there, though ...

>

Philipp

   [1]: http://lua-users.org/wiki/DecoratorsAndDocstrings
   [2]: https://github.com/siffiejoe/lua-annotate
   [3]:
https://github.com/siffiejoe/lua-annotate/blob/master/src/annotate/help.lua




Reply | Threaded
Open this post in threaded view
|

Re: Lua IPython Kernel

Elias Barrionovo
In reply to this post by Dirk Laurie-2
On Thu, Aug 28, 2014 at 3:53 AM, Dirk Laurie <[hidden email]> wrote:
>
> Neutral: Some of IPython's convenience comes from Python
> conventions we do not yet have in Lua, in particular its docstring.


Though often used just as a nice colored interactive shell with
tab-completion for Python, IPython is a lot more than that. In
particular, it features great support for parallelization
http://ipython.org/ipython-doc/stable/parallel/parallel_intro.html

I think this would be quite nice for Lua.


--
NI!

() - www.asciiribbon.org
/\ - ascii ribbon campaign against html e-mail and proprietary attachments