libera_utils.io.caching#

Module containing code to manage local file caching

Functions

empty_local_cache_dir()

Remove all cached files in the local cache.

get_local_cache_dir()

Determine where to cache files based on the system and installed package version.

get_local_short_temp_dir()

Get a short base directory for temporary files.

validate_path_length(path[, max_length])

Validate that a path doesn't exceed a maximum length.

libera_utils.io.caching.empty_local_cache_dir()#

Remove all cached files in the local cache.

Returns:

List of removed files

Return type:

list

libera_utils.io.caching.get_local_cache_dir()#

Determine where to cache files based on the system and installed package version.

Returns:

Path to the cache directory for this version of this package on the current system

Return type:

pathlib.Path

libera_utils.io.caching.get_local_short_temp_dir() Path#

Get a short base directory for temporary files.

Returns a platform-appropriate short path that respects environment variables for customization.

Returns:

A short base path for temporary directories.

Return type:

Path

libera_utils.io.caching.validate_path_length(path: Path, max_length: int = 80) None#

Validate that a path doesn’t exceed a maximum length. This is used primarily for SPICE kernels to avoid issues with overly long file paths (>80 characters) that fail in the C implementation of SPICE.

Parameters:
  • path (Path) – The path to validate.

  • max_length (int) – Maximum allowed path length (default: 80 for SPICE).

Raises:

RuntimeError – If path exceeds maximum length with helpful error message.