cobra.core.configuration
========================

.. py:module:: cobra.core.configuration

.. autoapi-nested-parse::

   Provide a global configuration object.



Classes
-------

.. autoapisummary::

   cobra.core.configuration.Configuration


Module Contents
---------------

.. py:class:: Configuration(**kwargs)

   Define a global configuration object.

   The attributes of this singleton object are used as default values by cobra
   functions.

   .. attribute:: solver

      The default solver for new models. The solver choices are the ones
      provided by `optlang` and depend on solvers installed in your environment.

      :type: {"glpk", "cplex", "gurobi", "glpk_exact"}

   .. attribute:: tolerance

      The default tolerance for the solver being used (default 1E-07).

      :type: float, optional

   .. attribute:: lower_bound

      The standard lower bound for reversible reactions (default -1000).

      :type: float, optional

   .. attribute:: upper_bound

      The standard upper bound for all reactions (default 1000).

      :type: float, optional

   .. attribute:: bounds

      The default reaction bounds for newly created reactions. The bounds
      are in the form of lower_bound, upper_bound (default -1000.0, 1000.0).

      :type: tuple of floats

   .. attribute:: processes

      A default number of processes to use where multiprocessing is
      possible. The default number corresponds to the number of available
      cores (hyperthreads) minus one.

      :type: int > 0

   .. attribute:: cache_directory

      A path where the model cache should reside if caching is desired. The
      default directory depends on the operating system.

      :type: pathlib.Path or str, optional

   .. attribute:: max_cache_size

      The allowed maximum size of the model cache in bytes (default 1 GB).

      :type: int, optional

   .. attribute:: cache_expiration

      The expiration time in seconds for the model cache if any (default None).

      :type: int, optional


   .. py:attribute:: _solver
      :value: None



   .. py:attribute:: tolerance
      :value: 1e-07



   .. py:attribute:: lower_bound
      :value: None



   .. py:attribute:: upper_bound
      :value: None



   .. py:attribute:: processes
      :value: None



   .. py:attribute:: _cache_directory
      :value: None



   .. py:attribute:: max_cache_size
      :value: 104857600



   .. py:attribute:: cache_expiration
      :value: None



   .. py:property:: bounds
      :type: Tuple[Optional[numbers.Number], Optional[numbers.Number]]


      Return the lower, upper reaction bound pair.

      :returns: The lower and upper bounds for new reactions.
      :rtype: tuple of number and number or None and None


   .. py:method:: _set_default_solver() -> None

      Set the default solver from a preferred order.



   .. py:method:: _set_default_processes() -> None

      Set the default number of processes.



   .. py:method:: _set_default_cache_directory() -> None

      Set the platform-dependent default cache directory.



   .. py:property:: solver
      :type: types.ModuleType


      Return the optlang solver interface.


   .. py:property:: cache_directory
      :type: pathlib.Path


      Return the model cache directory.


   .. py:method:: __repr__() -> str

      Return a string representation of the current configuration values.



   .. py:method:: _repr_html_() -> str

      Return a rich HTML representation of the current configuration values.

      .. rubric:: Notes

      This special method is used automatically in Jupyter notebooks to display a
      result from a cell.



