This module holds the Nutils global configuration, stored as (immutable) attributes. To inspect the current configuration, use print() or vars() on this module. The configuration can be changed temporarily by calling this module with the new settings passed as keyword arguments and entering the returned context. The old settings are restored as soon as the context is exited. Example:

>>> from nutils import config
>>> config.verbose
>>> with config(verbose=2, nprocs=4):
...   # The configuration has been updated.
...   config.verbose
>>> # Exiting the context reverts the changes:
>>> config.verbose


The default entry point for Nutils scripts (and nutils.cli.choose()) will read user configuration from disk.


The configuration is not thread-safe: changing the configuration inside a thread changes the process wide configuration.

The following configuration properties are used in Nutils.


Controls the number of processes to use for computing integrals (nutils.topology.Topology.integrate()) and a few other expensive and parallelizable functions.

Defaults to 1.


Controls the level of verbosity of loggers. Log entries with a level higher than verbose are omitted. The levels are 1: error, 2: warning, 3: user, 4: info and 5: debug.

Defaults to 4: info.

If True, nutils.sample.Sample.integrate() and :meth:nutils.sample.Sample.eval` log a visualization of the function tree that is being evaluated or integrated.

Defaults to False.

The following properties are only used in and nutils.cli.choose().


Defines the root directory for general output.

Defaults to '~/public_html'


Defines the output directory for the HTML log and plots. Relative paths are relative with respect to the current working directory (see os.getcwd()).

Defaults to '<outrootdir>/<scriptname>/<YY/MM/DD/HH-MM-SS>'


Controls on-disk caching. If True, functions decorated with nutils.cache.function() (e.g. nutils.topology.Topology.integrate()) and subclasses of nutils.cache.Recursion (e.g. nutils.solver.thetamethod) are automatically cached.

Defaults to False.


Defines the location of the on-disk cache (see cache) relative to <outrootdir>/<scriptname>.

Defaults to 'cache'.

If not empty, the symlinks '<outrootdir>/<symlink>' and '<outrootdir>/<scriptname>/<symlink>' will be created, both pointing to '<outrootdir>/<scriptname>/<YY/MM/DD/HH-MM-SS>'.

Defaults to ''.


Controls whether or not the console logger should output rich text or plain text.

Defaults to True if sys.stdout is attached to a terminal (i.e. sys.stdout.isatty() returns true), otherwise False.


If True the HTML logger is enabled and written to '<outrootdir>/<scriptname>/<YY/MM/DD/HH-MM-SS>/log.html'

Defaults to True.


If True the debugger will be invoked when an exception reaches or nutils.cli.choose().

Defaults to False.


A comma-separated list of matrix backends. The first one available is activated. The names — the case is irrelevant – correspond to subclasses of nutils.matrix.Backend. Use nutils.matrix.Backend.__subclasses__() to list the available backends.

Defauls to 'mkl,scipy,numpy'.