util.jl Documentation
The util.jl file provides a suite of utility functions primarily focused on filesystem navigation, project root discovery, and environment verification for the DSO API. These functions are not exported by the DataScienceOperations.jl module.
DataScienceOperations.is_relative_to — Function
is_relative_to(; path::AbstractString, barrier::AbstractString)::BoolCheck whether path is inside barrier (i.e. barrier is a prefix of path)
Arguments
path::AbstractString: current directorybarrier::AbstractString: barrier definition
Output
bool that describes if path is inside barrier
DataScienceOperations.find_in_parent — Function
find_in_parent(; start_directory::AbstractString, file_or_folder::AbstractString, recurse_barrier::Union{Nothing,AbstractString}=nothing)::Union{Nothing,AbstractString}Recursively walk up to the folder directory from start_directory until we either find file_or_folder or reach the root.
Arguments
start_directory:AbstractString: The directory to start the search from.file_or_folder::AbstractString: File or folder that defines the project root.recurse_barrier::Union{Nothing,AbstractString}: Define barrier that will not be exceeded.
Output
The project root or nothing.
Notes
Walks up from start_directory looking for file_or_folder. Returns the absolute path to the discovered file_or_folder (as a String), or nothing if not found. If recurse_barrier is provided we will not walk above that directory.
DataScienceOperations.get_project_root — Function
get_project_root(start_directory::AbstractString)::AbstractStringFind the project root by locating the nearest parent .git entry and returning its parent.
Arguments
start_directory::AbstractString: The directory to start the search from.
Output
The project root.
Notes
Throws an error if .git cannot be found (mimics Python FileNotFoundError behaviour).
DataScienceOperations.dso_cli_available — Function
dso_cli_available()::BoolChecks the DSO CLI is available in the System PATH.
Output
A bool that states if DSO CLI is available or not.
DataScienceOperations.run_dso_cli — Function
run_dso_cli(command::Base.ProcessChain)::NothingHelper function that executes the dso command
Arguments
command::Base.ProcessCain: Process to be executed
Output
nothing
DataScienceOperations.read_safe_yaml — Function
read_safe_yaml(params_file::AbstractString)::DictReads params YAML.
Arguments
-params_file::AbstractString: path to the parameter file
Output
Parameters in dictionary format
Examples
params_dict = read_safe_yaml("path/to/params.yaml")