Package mdp :: Class config
[hide private]
[frames] | no frames]

Class config


Provide information about optional dependencies.

This class should not be instantiated, it serves as a namespace for dependency information. This information is encoded as a series of attributes called has_<dependency>.

Dependency parameters are object which have a a boolean value (True if the dependency is available). If False, they contain an error string which will be used in mdp.config.info() output. If True, they contain information about the available version of the dependency. Those objects should be created by using the helper class methods ExternalDepFound and ExternalDepFailed.

>>> bool(config.has_python)
True

Dependency parameters are numbered in the order of creation, so the output is predictable.

The selection of the numerical backend (numpy or scipy) can be forced by setting the environment variable MDPNUMX. The loading of an optional dependency can be inhibited by setting the environment variables MDP_DISABLE_<DEPNAME> to a non-empty value.

The following variables are defined:
MDPNUMX
either numpy or scipy. By default the latter is used if available.
MDP_DISABLE_PARALLEL_PYTHON
inhibit loading of mdp.parallel based on parallel python (module pp)
MDP_DISABLE_SHOGUN
inhibit loading of the shogun classifier
MDP_DISABLE_LIBSVM
inhibit loading of the svm classifier
MDP_DISABLE_JOBLIB
inhibit loading of the joblib module and mdp.caching
MDP_DISABLE_SKLEARN
inhibit loading of the sklearn module
MDPNSDEBUG
print debugging information during the import process
MDP_PP_SECRET
set parallel python (pp) secret. If not set, and no secret is known to pp, a default secret will be used.
MDP_DISABLE_MONKEYPATCH_PP
disable automatic monkeypatching of parallel python worker script, otherwise a work around for debian bug #620551 is activated.
Nested Classes [hide private]
  _ExternalDep
Instance Methods [hide private]

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
ExternalDepFailed(cls, name, failmsg)
Inform that an optional dependency was not found.
 
ExternalDepFound(cls, name, version)
Inform that an optional dependency was found.
 
info(cls)
Return nicely formatted info about MDP.
Class Variables [hide private]
  _HAS_NUMBER = 9
  has_joblib = 0.9.4
  has_libsvm = libsvm.so.3
  has_mdp = 3.5, MDP-3.4-11-g7391ee8+
  has_numx = scipy 0.17.0
  has_parallel_python = 1.6.4
  has_python = 2.7.11.final.0
  has_shogun = NOT AVAILABLE: only shogun v1 is supported
  has_sklearn = 0.17.1
  has_symeig = scipy.linalg.eigh
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

ExternalDepFailed(cls, name, failmsg)
Class Method

 

Inform that an optional dependency was not found.

A new _ExternalDep object will be created and stored in config.

Parameters:
  • name - identifier of the optional dependency. This should be a valid python identifier, because it will be accessible as mdp.config.has_<name> attribute.
  • failmsg - an object convertible to str, which will be displayed in mdp.config.info() output. This will usually be either an exception (e.g. ImportError), or a message string.

ExternalDepFound(cls, name, version)
Class Method

 

Inform that an optional dependency was found.

A new _ExternalDep object will be created and stored in config.

Parameters:
  • name - identifier of the optional dependency. This should be a valid python identifier, because it will be accessible as mdp.config.has_<name> attribute.
  • version - an object convertible to str, which will be displayed in mdp.config.info() output. Something like '0.4.3'.

info(cls)
Class Method

 

Return nicely formatted info about MDP.

>>> print mdp.config.info()                           # doctest: +SKIP
          python: 2.7.2.final.0
             mdp: 3.3, MDP-3.2-9-g4bc7356+
 parallel python: 1.6.1-monkey-patched
          shogun: v1.1.0_02ce3cd_2011-12-12_08:17_
          libsvm: libsvm.so.3
          joblib: 0.5.4
         sklearn: 0.9
            numx: scipy 0.9.0
          symeig: scipy.linalg.eigh

This function is used to provide the py.test report header and footer.


Class Variable Details [hide private]

_HAS_NUMBER

Value:
9

has_joblib

Value:
0.9.4

has_libsvm

Value:
libsvm.so.3

has_mdp

Value:
3.5, MDP-3.4-11-g7391ee8+

has_numx

Value:
scipy 0.17.0

has_parallel_python

Value:
1.6.4

has_python

Value:
2.7.11.final.0

has_shogun

Value:
NOT AVAILABLE: only shogun v1 is supported

has_sklearn

Value:
0.17.1

has_symeig

Value:
scipy.linalg.eigh