skip to navigation
skip to content

taco 0.1.0

Taco module for Python

Taco Module for Python


.. starttacointro

Taco is a system for bridging between scripting languages.
Its goal is to allow you to call routines written for one language from
It does this by running the second language interpreter in a sub-process,
and passing messages about actions to be performed inside that interpreter.

In principle, to interface scripting languages it might be preferable
to embed the interpreter for one as an extension of the other.
However this might not be convenient or possible,
and would need to be repeated for each combination of languages.
Instead Taco only requires a "client" module and "server" script
for each language, which should be straightforward to install,
and its messages are designed to be generic so that they
can be used between any combination of languages.

For more information about Taco, please see the
`Taco Homepage`_.

.. _`Taco Homepage`:

.. endtacointro


Here are examples of the different types of responses
which may result from a Taco call:

.. starttacoreturn

* Function Results

If you find that you need the weighted ``roll_dice()``
function from the `Acme::Dice`_ Perl module,
you can import it and call the function as follows:

>>> from taco import Taco
>>> taco = Taco(lang='perl')
>>> taco.import_module('Acme::Dice', 'roll_dice')
>>> taco.call_function('roll_dice', dice=1, sides=6, favor=6, bias=100)

In this example, instantiating a ``Taco`` object starts a
sub-process running a Perl script.
This "server" script then handles the instructions to
import a module and call one of its functions,
returning the value 6.

* Object References

To allow the use of object-oriented modules such as
references to objects are returned
as instances of the ``TacoObject`` class.

>>> taco.import_module('Acme::PricelessMethods')
>>> pm = taco.construct_object('Acme::PricelessMethods')
>>> type(pm)
<class 'taco.object.tacoobject'="">

These objects can be used to invoke further actions:

>>> pm.call_method('is_machine_on')

* Exceptions

``roll_dice()`` raises an exception if we try to roll more than 100 dice.
The exception is caught and re-raised on the "client" side:

>>> taco.call_function('roll_dice', dice=1000)
Traceback (most recent call last):
taco.error.TacoReceivedError: ... Really? Roll 1000 dice? ...

.. _Acme::Dice:

.. _Acme::PricelessMethods:

.. endtacoreturn

.. starttacoinstall


The module can be installed using the ```` script::

python install

Before doing that, you might like to run the unit tests::

PYTHONPATH=lib python -m unittest -v

For Python 2, it might be necessary to include the command ``discover``
after the ``unittest`` module name.
If successful you should see a number of test cases being run.

Integration Tests

This package also includes further integration tests which test
the complete system.
These tests are stored in files named ``ti_*.py`` to avoid them
being found by ``unittest`` discovery with its default
They all use the Python "client" module but a variety
of "server" scripts.

* Python

The tests using a Python "server" script can be run directly from this

PYTHONPATH=lib python -m unittest discover -v -s 'ti-python' -p 'ti_*.py'

* Other Languages

The following tests all require a Taco "server" script for the
corresponding language to be installed in your search path.

* Perl ::

PYTHONPATH=lib python -m unittest discover -v -s 'ti-perl' -p 'ti_*.py'

.. endtacoinstall


This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http:"" licenses=""/>.

Additional Links

* `Documentation at Read the Docs <http:"" en="" latest=""/>`_
* `Repository at GitHub <https:"" grahambell="" taco-python="">`_
* `Taco Homepage`_  
File Type Py Version Uploaded on Size
taco-0.1.0.tar.gz (md5) Source 2014-03-24 22KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 16 downloads in the last week
  • 98 downloads in the last month