bitorch_engine.utils.mlx_path.get_mlx_lib_path

bitorch_engine.utils.mlx_path.get_mlx_lib_path() str | None[source]

Attempts to find the library path for ‘libmlx.dylib’.

This function searches for the ‘libmlx.dylib’ file in various locations to determine the library path for mlx (a hypothetical library). The search follows this order:

  1. Within the ‘mlx’ package’s installation directory, if the package is installed. It looks for a ‘lib’ directory under the package’s submodule search locations.

  2. In the ‘lib’ directory under the Python environment’s prefix directory. This is typically where libraries are installed for the current Python environment.

  3. In directories specified in the ‘LIBRARY_PATH’ environment variable. This is a colon-separated list of directories where libraries are searched for on Unix-like systems.

The function returns the path as a string if ‘libmlx.dylib’ is found, or None if the library cannot be found in any of the searched locations.

Returns:

The path to ‘libmlx.dylib’ if found, otherwise None.

Return type:

str or None