[vistrails-users] Custom Types for Ports

Rémi Rampin remi.rampin at nyu.edu
Fri Aug 8 09:45:48 EDT 2014

2014-08-07 16:20 EDT, Michael Noseworthy:

>  I am in the process of writing my own modules and was wondering if its
> possible to package multiple ports into one (for example have one port that
> contains both a String and Float value). So when an input port/output port
> are connected  like this, both pieces of data get passed through a single
> port instead of two separate ones.

Hi Michael,

While this is doable with some amount of trickery, it is not currently
supported. Ports can have "tuple" types like you describe, e.g. "(String,
Float)", but these are not automatically constructed by passing separate
connections on a port. When packing or unpacking is required, you are
supposed to use the Tuple and Untuple modules, like so:

In this example, YourModule is defined as follow:

class YourModule(Module): _input_ports = [('input', '(basic:String,
basic:Float)')] _output_ports = [('output', '(basic:String, basic:Float)')]

Also, is it possible to define my own types for ports so I am not limited
> to the basic String, Float, Integer, etc.?

You can use any Module class as type for a port.

Thank you for using VisTrails,
Rémi Rampin
VisTrails developer
Polytechnic School of Engineering, New York University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vistrails.org/pipermail/vistrails-users/attachments/20140808/2975f582/attachment.html>

More information about the vistrails-users mailing list