em_database.config#
Runtime settings for em_database, in the style of matplotlib’s rcParams.
em_database.settings is a live dict, seeded at import from a YAML file (or
the built-in defaults). Change it in memory:
import em_database
em_database.settings["data_dir"] = "/big/disk/em_data"
and it takes effect immediately. To remember the choice across sessions, persist it:
em_database.settings.save()
Settings live in a ~/.em_database folder (~/.em_database/settings.yaml),
or wherever EM_DATABASE_CONFIG points. No environment variable is needed to
configure em_database - the settings object is the source of truth; the old
EM_DATABASE_DATA_DIR is still honored as a seed for backward compatibility.
Data can also be installed system-wide and shared by every user. When
resolving where a dataset lives, em_database looks in the shared/system
locations first, then the user’s own data directory, and only downloads (into
the user directory) if it is nowhere to be found. Shared locations come from a
system config file (see system_config_path()), the EM_DATABASE_SHARED_DIR
environment variable (an os.pathsep-separated list), or a shared_data_dirs
list in the user’s settings.
Module Attributes
|
Built-in defaults - the fallback when nothing is configured. |
|
The live settings object (seeded once at import). |
Functions
|
The |
|
Path to the YAML settings file. |
|
The user's data directory - where downloads are written. |
|
Everywhere to look for an existing dataset: shared/system dirs first, then the user's data directory. |
|
System-wide / shared data locations, checked before the user's dir. |
|
Path to the machine-wide settings file (for system-wide installs). |
Classes
|
A live settings mapping that can persist itself to the YAML file. |