quantlab.config.set_data_root#
- quantlab.config.set_data_root(path)[source]#
Set the process-level storage root, ahead of the environment variable.
The value is passed through
expanduserbut notresolve: theQUANTLAB_DATA_DIRvalue is used unresolved too, so the two behave the same on a symlinked root, and a quoted'~/x'from a shell reaches Python with a literal tilde that would otherwise become a directory named~. The directory is neither created nor required to exist.- Parameters:
- pathstr | os.PathLike | None
The new root.
Noneclears the override so thatQUANTLAB_DATA_DIRor the default root applies again.
- Returns:
- Path | None
The stored
Path, orNonewhen the override was cleared.
- Raises:
- ValueError
If
pathis an empty or whitespace-only string. An empty environment variable falls through to the default, but a root someone typed explicitly should not silently mean “default”.
Examples
>>> set_data_root("/mnt/quant") PosixPath('/mnt/quant') >>> set_data_root(None) is None True