OpenAlea core’s API¶
openalea.core.package¶
This module defines Package classes.
A Package is a deplyment unit and contains a factories (Node generator) and meta informations (authors, license, doc...)
- class openalea.core.package.AbstractPackageReader(filename)[source]¶
Abstract class to add a package in the package manager.
- class openalea.core.package.DynamicPackage(name, metainfo)[source]¶
Package for dynamical parsing of python file
- class openalea.core.package.Package(name, metainfo, path=None)[source]¶
A Package is a dictionnary of node factory. Each node factory is able to generate node and their widgets.
Meta informations are associated with a package.
- get_metainfo(key)[source]¶
Return a meta information. See the standard key in the __init__ function documentation.
Parameters: key – todo
- get_pkg_files()[source]¶
Return the list of python filename of the package. The filename are relative to self.path
- is_directory()[source]¶
New style package. A package is embeded in a unique directory. This directory can not contain more than one package. Thus, you can move, copy or delete a package by acting on the directory without ambiguity.
Return True if the package is embeded in a directory.
- mimetype = 'openalea/package'¶
- class openalea.core.package.PyPackageReader(filename)[source]¶
Build packages from wralea file Use ‘register_package’ function
- class openalea.core.package.PyPackageReaderVlab(filename)[source]¶
Build a package from a vlab specification file.
- class openalea.core.package.PyPackageReaderWralea(filename)[source]¶
Build a package from a __wralea__.py Use module variable
- class openalea.core.package.PyPackageWriter(package)[source]¶
Write a wralea python file
- pkg_template = '\n$PKGNAME\n\n$METAINFO\n\n$ALL\n\n$FACTORY_DECLARATION\n'¶
- wralea_template = '\n# This file has been generated at $TIME\n\nfrom openalea.core import *\n\n$PKG_DECLARATION\n\n'¶
- class openalea.core.package.UserPackage(name, metainfo, path=None)[source]¶
Package user editable and persistent
- create_user_compositenode(name, category, description, inputs, outputs)[source]¶
Add a new user composite node factory to the package and save the package. Returns the cn factory.
openalea.core.pkgmanager¶
This module defines the package manager.
It is able to find installed package and their wralea.py It stores the packages and nodes informations
- class openalea.core.pkgmanager.PackageManager(verbose=True)[source]¶
The PackageManager is a Dictionary of Packages It can locate OpenAlea packages on the system (with wralea).
- add_wralea_path(path, container)[source]¶
Add a search path for wralea files
Parameters: - path – a path string
- container – set containing the path
- 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.
- find_and_register_packages(no_cache=False)[source]¶
Find all wralea on the system and register them If no_cache is True, ignore cache file
- 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
- find_wralea_dir(directory, recursive=True)[source]¶
Find in a directory wralea files, Search recursivly is recursive is True
:return : a list of pkgreader instances
- find_wralea_files()[source]¶
Find on the system all wralea.py files
:return : a list of pkgreader instances
- 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”}
- init(dirname=None, verbose=True)[source]¶
Initialize package manager
If dirname is None, find wralea files on the system else load directory If verbose is False, don’t print any output
- instance = None¶
- missing_dependencies(package_or_factory=None)[source]¶
Return all the dependencies of a package or a factory.
- 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)
- class openalea.core.pkgmanager.PseudoGroup(name)[source]¶
Data structure used to separate dotted naming (packages, category)
- mimetype = 'openalea/package'¶
- sep = '.'¶