7.1.2.15. pycropml.package module¶
from pycropml import composition from pycropml.pparse import model_parser from path import Path import networkx as nx from collections import defaultdict from IPython.display import Image, display from networkx.drawing.nx_pydot import to_pydot from pycropml.render_cyml import signature
-
class
pycropml.package.
AbstractPackageReader
(filename)[source]¶ Bases:
object
Abstract class to add a package in the package manager.
-
class
pycropml.package.
Package
(name, metainfo, path=None)[source]¶ Bases:
pycropml.package.PackageDict
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. :param key: todo
-
get_pkg_files
()[source]¶ Return the list of xml 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
= 'pycrop2ml/package'¶
-
-
class
pycropml.package.
PackageDict
(*args)[source]¶ Bases:
dict
Dictionnary with case insensitive key This object is able to handle protected entry begining with an ‘#’
-
class
pycropml.package.
PackageManager
[source]¶ Bases:
object
-
add_crop2ml_path
(path, container)[source]¶ Add a search path for wralea files
Parameters: - path – a path string
- container – set containing the path
-
find_and_register_packages
(no_cache=False)[source]¶ Find all composite model on the system and register them If no_cache is True, ignore cache file
-
find_crop2ml_dir
(directory, recursive=True)[source]¶ Find in a directory wralea files, Search recursivly is recursive is True
:return : a list of pkgreader instances
-
init
(dirname=None, verbose=True)[source]¶ Initialize package manager
If dirname is None, find composition files on the system else load directory
-
reload
(pkg=None)[source]¶ Reload one or all packages. If the package pkg is None reloa all the packages. Else reload only pkg.
-
-
class
pycropml.package.
PseudoGroup
(name)[source]¶ Bases:
pycropml.package.PackageDict
Data structure used to separate dotted naming (packages, category)
-
mimetype
= 'pycrop2ml/package'¶
-
sep
= '.'¶
-
-
class
pycropml.package.
PyPackageReader
(filename)[source]¶ Bases:
pycropml.package.AbstractPackageReader
Build packages from wralea file Use ‘register_package’ function
-
class
pycropml.package.
PyPackageReaderModel
(filename)[source]¶ Bases:
pycropml.package.PyPackageReader
Build a package from a __wralea__.py Use module variable
-
class
pycropml.package.
PyPackageWriter
(package)[source]¶ Bases:
object
Write a wralea python file
-
pkg_template
= '\n$PKGNAME\n$METAINFO\n'¶
-
wralea_template
= '\n# This file has been generated at $TIME\n$PKG_DECLARATION\n'¶
-
-
class
pycropml.package.
UserPackage
(name, metainfo, path=None)[source]¶ Bases:
pycropml.package.Package
Package user editable and persistent
-
pycropml.package.
get_default_home_dir
()[source]¶ Return the home directory (valid on linux and windows)
-
pycropml.package.
get_openalea_home_dir
(name='.pycrop2ml')[source]¶ Return the crop2ml home directory If it doesn’t exist, create it