openalea.vpltk.catalog package

Submodules

openalea.vpltk.catalog.adapter module

class openalea.vpltk.catalog.adapter.Register[source]

Bases: dict

adapter(interface_in, interface_out)[source]
instance = None
openalea.vpltk.catalog.adapter.adapt(obj, interface, interface_in=None)[source]

openalea.vpltk.catalog.catalog module

class openalea.vpltk.catalog.catalog.Catalog(verbose=True)[source]

Bases: object

create_service(object_factory, *args, **kargs)[source]

Create a service from object_factory. If object_factory is None, returns None. If this factory is called for the first time, instantiate it with args and kargs. Else, use previous instance.

factories(interfaces=None, name=None, tags=None, exclude_tags=None)[source]
Parameters:
  • exclude_tags – if tags is not specified, scan all tags except one defined in exclude_tags
  • interfaces – by default do not check interfaces so return all factories

TODO: tags and exclude_tags need to be clarified

factory(interfaces=None, name=None, tags=None, exclude_tags=None)[source]

get factories matching given criteria (interfaces, name, tags). criterion=None means criterion is not used. If all criteria are None (default) it returns all factories.

instance = None
interface(name)[source]
interface_id(interface)[source]
interfaces(obj=None)[source]
is_implementation(obj, interface)[source]
service(interfaces=None, name=None, tags=None, exclude_tags=None, args=None, kargs=None)[source]

args and kargs are not currently used but defined for future additional filters. For example “author=’John Doe’”.

TODO: tags and exclude_tags need to be clarified

services(interfaces=None, name=None, tags=None, exclude_tags=None, args=None, kargs=None)[source]

See Catalog.service.

openalea.vpltk.catalog.controller module

class openalea.vpltk.catalog.controller.Controller[source]

Bases: object

class openalea.vpltk.catalog.controller.Implementation[source]

Bases: object

openalea.vpltk.catalog.factories module

class openalea.vpltk.catalog.factories.ObjectFactory(name, description='', category='', interfaces=None, inputs=None, outputs=None, nodemodule='', nodeclass=None, search_path=None, authors=None, **kargs)[source]

Bases: openalea.core.node.NodeFactory

classobj()[source]
instantiate(*args, **kargs)[source]

openalea.vpltk.catalog.interface module

class openalea.vpltk.catalog.interface.IInterface(**kargs)[source]

Bases: openalea.core.interface.IInterface

category = 'interfaces'
classmethod is_valid()[source]

openalea.vpltk.catalog.interfaces module

class openalea.vpltk.catalog.interfaces.ICatalog(**kargs)[source]

Bases: openalea.vpltk.catalog.interface.IInterface

ICatalog is a meta plugin manager. It is used to discover all plugins and especially interfaces.

Properties :

  • plugin_types = (‘wralea’, ‘plugin’, ‘adapters’, ‘interfaces’)
  • groups : list all entry_point groups found on this system
  • managers : list of PluginManager currently used. At launch, only plugin manager (generic place) and interface manager are defined.
create_service(object_factory, *args, **kargs)[source]

Create a service from object_factory. If object_factory is None, returns None. If this factory is called for the first time, instantiate it with args and kargs. Else, use previous instance.

factories(interfaces=None, name=None, tags=None, exclude_tags=None)[source]

Returns all factories matching given criteria. exclude_tags: if tags is not specified, scan all tags except one defined in exclude_tags

factory(interfaces=None, name=None, tags=None, exclude_tags=None)[source]

Returns first factory matching given criteria.

interface(name)[source]

Returns interface class associated to name

interface_id(interface)[source]

Returns name of “interface” class

interfaces(obj=None)[source]

Returns list of all interface names. If obj is defined, returns list of names of interfaces implemented by this object.

is_implementation(obj, interface)[source]

Returns True if obj implements interface.

Parameters:interface – Interface class or name
service(interfaces=None, name=None, tags=None, exclude_tags=None, args=None, kargs=None)[source]

Returns first service matching given criteria.

services(interfaces=None, name=None, tags=None, exclude_tags=None, args=None, kargs=None)[source]

Returns all services matching given criteria.

class openalea.vpltk.catalog.interfaces.IRegister(**kargs)[source]

Bases: openalea.vpltk.catalog.interface.IInterface

dictionary of adapters

openalea.vpltk.catalog.pluginmanager module

This module defines the package manager.

It is able to find installed package and their plugin.py It stores the packages and nodes informations

class openalea.vpltk.catalog.pluginmanager.PluginManager(plugin_type='plugin', verbose=True)[source]

Bases: openalea.grapheditor.observer.Observed

The PluginManager is a Dictionary of Packages It can locate OpenAlea packages on the system (with plugin).

add_package(package)[source]

Add a package to the pkg manager

add_plugin_path(path, container)[source]

Add a search path for plugin files

Parameters:
  • path – a path string
  • container – set containing the path
clear()[source]

Remove all packages

create_readers(plugin_files)[source]
create_user_package(name, metainfo, path=None)[source]

Create a new package in the user space and register it Return the created package :param path : the directory where to create the package

dependencies(package_or_factory=None)[source]

Return all the dependencies of a package or a factory.

emit_update()[source]
find_all_plugin()[source]

Find on the system all plugin.py files

:return : a list of file paths

find_and_register_packages(no_cache=False)[source]

Find all plugin on the system and register them If no_cache is True, ignore cache file

find_plugin_dir(directory, recursive=True)[source]

Find in a directory plugin files, Search recursivly is recursive is True

:return : a list of pkgreader instances

find_plugin_files()[source]

Find on the system all plugin.py files

:return : a list of pkgreader instances

find_vlab_dir(directory, recursive=True)[source]

Find in a directory vlab specification file.

Search recursivly is recursive is True

Returns:a list of pkgreader instances
get(*args)[source]
get_composite_nodes(pkg_name=None)[source]
get_data(pattern='*.*', pkg_name=None, as_paths=False)[source]

Return all data that match the pattern.

get_factory_from_url(url)[source]

Returns a node instance from the given url.

Parameters:
  • url - is either a string or a urlparse.ParseResult instance.

It is encoded this way: oa://domain/packageName?fac=*factoryName*&ft=*factoryType* . “oa” means that it is meant to be used by openalea. “domain” MUST BE “local” for now. “packageName” is the name of the package “factoryName” is the of factory “factoryType” is one of {“CompositeNodeFactory”, “NodeFactory”, “DataFactory”}

get_node(pkg_id, factory_id)[source]

Return a node instance giving a pkg_id and a factory_id

get_node_from_url(url)[source]
get_nodes(pkg_name=None)[source]
get_package_from_url(url)[source]
get_packages(pkg_name=None)[source]

Return all public packages.

get_pkgreader(filename)[source]

Return the pkg reader corresponding to the filename

get_plugin_path()[source]

return the list of plugin path (union of user and system)

get_pseudo_cat()[source]

Return a pseudo category structure

get_pseudo_pkg()[source]

Return a pseudopackage structure

get_user_packages()[source]

Return the list of user packages

has_key(*args)[source]
init(dirname=None, verbose=True)[source]

Initialize package manager

If dirname is None, find plugin files on the system else load directory If verbose is False, don’t print any output

items()[source]
iteritems()[source]
iterkeys()[source]
itervalues()[source]
keys()[source]
load_directory(dirname)[source]

Load a directory containing plugins

missing_dependencies(package_or_factory=None)[source]

Return all the dependencies of a package or a factory.

rebuild_category()[source]

Rebuild all the category

recover_syspath()[source]

Restore the initial sys path

reload(pkg=None)[source]

Reload all packages if pkg is None else reload only pkg

rename_package(old_name, new_name)[source]

Rename package ‘old_name’ to ‘new_name’

search_node(search_str, nb_inputs=-1, nb_outputs=-1)[source]

Return a list of Factory corresponding to search_str If nb_inputs or nb_outputs is specified, return only node with the same number of (in/out) ports

The results are sorted in the following way:
1 - Highest Priority : presence of search_str in factory name
and position in the name (closer to the begining = higher score)
2 - Then : Number of occurences of search_str in the factory
description.

3 - Then : Number of occurences of search_str in the category name 4 - Finally : presence of search_str in package name and position

in the name (close to the begining = higher score)
set_sys_plugin_path()[source]

Define the default plugin search path For that, we look for “plugin” entry points and deprecated_plugin entry point if a package is declared as deprecated_plugin, the module is not load

set_user_plugin_path()[source]

Read user config

update_category(package)[source]

Update the category dictionary with package contents

values()[source]
who_use(factory_name)[source]

Search who use a package or a factory

return a list of factory.

write_config()[source]

Write user config

class openalea.vpltk.catalog.pluginmanager.PseudoGroup(name)[source]

Bases: openalea.core.pkgdict.PackageDict

Data structure used to separate dotted naming (packages, category)

add_name(name, value)[source]

Add a value in the structure with the key name_tuple

get_id()[source]

todo

get_tip()[source]

todo

mimetype = 'openalea/package'
new(name)[source]

todo

sep = '.'
class openalea.vpltk.catalog.pluginmanager.PseudoPackage(name)[source]

Bases: openalea.vpltk.catalog.pluginmanager.PseudoGroup

Package structure used to separate dotted naming (packages, category)

get_metainfo(key)[source]

todo

get_tip()[source]

todo

is_real_package()[source]

todo

new(name)[source]

todo

openalea.vpltk.catalog.pluginmanager.cmp_name(x, y)[source]

Comparison function

openalea.vpltk.catalog.tools module

openalea.vpltk.catalog.tools.color_interface_line(interface_id)[source]
openalea.vpltk.catalog.tools.list_implementations()[source]
openalea.vpltk.catalog.tools.list_interfaces()[source]

Module contents