Configuration

This module generates the “~/.exa” directory where all databases, logs, notebooks, and data reside. This configuration may be altered by editing the items below:

paths:
  • data: Path to the data directory (default ~/.exa/data)
  • notebooks: Path to the notebooks directory (default ~/.exa/notebooks)
log:
  • nlogs: Number of log files to rotate
  • nbytes: Max log file size (in bytes)
  • syslog: System log file path
  • dblog: Database log file path (if necessary)
  • level: Logging level, 0: normal, 1: extra info, 2: debug
db:
  • uri: String URI for database connection
  • update: If 1, refresh static database data (e.g. unit conversions)
js:
  • update: If 1, update JavaScript notebook extensions

Warning

The configuration file (~/.exa/config) should only be altered when no exa notebooks are running (i.e. exa or any of its related packages are imported).

exa._config.save()[source]

Save the configuration file to disk on exit, resetting update flags.

Warning

This is a bit unsafe because we are not guarenteed to hit the updating function during execution (that is what well written tests are for - use mock), but it is advantageous in the case that multiple packages that use exa are running simultaneously.

exa._config.set_update()[source]

Set update flags.

exa._config.del_update()[source]

Reset update flags.

Exceptions

All base level exceptions are defined here.

exception exa.error.ExaException(msg)[source]

Exception with support for logging.

exception exa.error.RequiredIndexError(missing, clsname)[source]

DataFrame index name error.

exception exa.error.RequiredColumnError(missing, clsname)[source]

DataFrame column error.

Logging

There are two log files that exa writes to, the system log and the database log. The database log is used when the database backend does not provide its own logging solution.

Levels:
  • 0: default (>= WARNING messages are logged)
  • 1: info (>= INFO messages are logged)
  • 2: debug (all messages are logged)
class exa.log.LogFormat(fmt=None, datefmt=None, style='%')[source]

Custom log format used by all loggers.

format(record)[source]

Overwrites the built-in format function (called when sending a message to the logger) with the specific format defined by this class.

exa.log.create_logger(name)[source]

Create a logger with a given name.