pyzenkit.utils module¶
This module contains various handy utilities.
-
pyzenkit.utils.
get_resource_path
(fs_path, *more_chunks)[source]¶ Return filesystem path to application resource with
APP_ROOT_PATH
taken into consideration. Iffs_path
is absolute theAPP_ROOT_PATH
will be ignored as usual.
-
pyzenkit.utils.
get_resource_path_fr
(fs_path, *more_chunks)[source]¶ Force given application filesystem path to be relative to
APP_ROOT_PATH
.
-
pyzenkit.utils.
load_dotenv
(path=None)[source]¶ Load “dotenv” files in order of precedence to set environment variables. If an env var is already set it is not overwritten, so earlier files in the list are preferred over later files.
Changes the current working directory to the location of the first file found, with the assumption that it is in the top level project directory and will be where the Python path should import local packages from. This is a no-op if
python-dotenv
is not installed.- Parameters
path (str) – Load the file at this location instead of searching.
- Returns
True
if a file was loaded.- Return type
bool
-
pyzenkit.utils.
load_dotenv_cwd
()[source]¶ Load “dotenv” files in order of precedence to set environment variables. If an env var is already set it is not overwritten, so earlier files in the list are preferred over later files. This method attempts to load
.env.local
and.env
files, if present in current directory.This is a no-op if
python-dotenv
is not installed.