2 Installation and starting the Logix shell

2.1 Installing

Logix installs as a single package, logix, in your site packages directory. Once you have downloaded the source distribution from http://logix.livelogix.com, unpack it to create the directory

            Logix-0.4

To install, execute the following command in that directory

> python setup.py install

That’s it!

2.2 The Logix Shell

Logix runs on top of Python. The Logix interactive top-level can be used with or without the enhanced python shell IPython (http://ipython.scipy.org/).

2.2.1 Standard Python Shell

To get to the interactive Logix prompt simply call logix.interact()

> python
>>> import logix
>>> logix.interact()
(type logix.license for more information)
Welcome to Logix
[std]:

Or

> python –c "import logix; logix.interact()"
(type logix.license for more information)
Welcome to Logix
[std]:

2.2.2 IPython Shell

The module logix.ipy provides some support for IPython. With IPython and Logix, you can flip between Python and Logix modes on the fly. The namespace (local variables) remains constant, so for example, you can define a function in Logix, and call it from Python.

The function logix.ipy.toggleLogixMode can be called to switch between Logix mode and regular Python mode. It should be passed the IPython application object __IP.

In [1]: import logix.ipy
In [2]: logix.ipy.toggleLogixMode(__IP)
(type logix.license for more information)
Welcome to Logix

[std]:

It is a good idea to set up an IPython ‘magic command’ for this, such as ‘lx’. (see http://ipython.scipy.org/doc/manual).

def magic_lx(self,parameter_s=''):
    import logix.ipy
    logix.ipy.toggleLogixMode(__IP)

You can then just enter lx to flip between Logix and Python modes.