zea.set_data_pathsΒΆ
- zea.set_data_paths(user_config=None, local=True, verify=True)[source]ΒΆ
Get data paths (absolute paths to location of data).
- Parameters:
user_config (
Union[str,dict,None]) β Path to a YAML file with user info. If None, uses./users.yamlas the default file. Can also be a dictionary structured as shown below.local (
bool|None) β Whether to pick thelocalor theremotepath for entries that define both (e.g. a local disk and a remote share). Default is True. Set to None when every path that applies is a plain string, i.e. shared between local and remote.verify (
bool) β Verify that the paths exist and are directories. Default is True.
Example YAML structure:
data_root: ... output: ...
You can also specify different
data_rootfor different users and machines:my_username: my_hostname: system: windows data_root: ... output: ... other_hostname: system: linux data_root: local: ... remote: ... # If both my_hostname and other_hostname are not matching, fallback to: system: linux data_root: ... other_username: data_root: ...
The machine section takes precedence over the user section, which takes precedence over the userless and machineless one at the bottom. Precedence is per key, so a section only needs to set what it changes: a machine that pins just
systemstill inheritsdata_rootandoutputfrom the levels above it.- Returns:
- Absolute paths to location of data. Stores the following parameters:
data_root,zea_root,output,system,username,hostname
- Return type:
- Raises:
ValueError β If
user_configis not a string, dictionary or None.
Note
When
user_configpoints to a YAML file that does not exist yet, an empty one is created and β when running interactively β you are offered to set up a profile, seecreate_new_user(). When nodata_rootcan be resolved for the current user and machine, a warning is raised and a default path for the current operating system is used.outputis optional and staysNonewhen the file does not set one.