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

MetaConfig 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

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.2
  has_mdp = 3.5
  has_numx = scipy 0.16.1
  has_parallel_python = NOT AVAILABLE: No module named pp
  has_python = 2.7.12.final.0
  has_shogun = NOT AVAILABLE: No module named shogun
  has_sklearn = NOT AVAILABLE: No module named scikits.learn
  has_symeig = scipy.linalg.eigh
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.2

has_mdp

Value:
3.5

has_numx

Value:
scipy 0.16.1

has_parallel_python

Value:
NOT AVAILABLE: No module named pp

has_python

Value:
2.7.12.final.0

has_shogun

Value:
NOT AVAILABLE: No module named shogun

has_sklearn

Value:
NOT AVAILABLE: No module named scikits.learn

has_symeig

Value:
scipy.linalg.eigh