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_toFunction
is_relative_to(; path::AbstractString, barrier::AbstractString)::Bool

Check whether path is inside barrier (i.e. barrier is a prefix of path)

Arguments

  • path::AbstractString: current directory
  • barrier::AbstractString: barrier definition

Output

bool that describes if path is inside barrier

source
DataScienceOperations.find_in_parentFunction
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.

source
DataScienceOperations.get_project_rootFunction
get_project_root(start_directory::AbstractString)::AbstractString

Find 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).

source
DataScienceOperations.run_dso_cliFunction
run_dso_cli(command::Base.ProcessChain)::Nothing

Helper function that executes the dso command

Arguments

  • command::Base.ProcessCain: Process to be executed

Output

nothing

source
DataScienceOperations.read_safe_yamlFunction
read_safe_yaml(params_file::AbstractString)::Dict

Reads 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")
source