Skip to main content
`Ctrl`+`K`

# get_cache_dir_path

astropy.config.get_cache_dir_path(rootname='astropy', *, ensure_exists=True)

  Determines the cache directory associated with a namespace and, optionally, creates the directory if it doesn’t exist.

  This directory is typically `$XDG_CACHE_HOME/<namespace>`, but can be overwritten with the `ASTROPY_CACHE_DIR` environment variable, or with `temporary_cache_dir_path()`.

  Added in version 7.0.

  Changed in version 8.0: In previous versions, the return value pointed to `$HOME/.astropy/cache` by default. A new environment variable `ASTROPY_CACHE_DIR` is now supported. Symlinks are no longer created in any situation.

  Parameters:
    rootname `python:str`, optional

      Namespace associated with the directory. For example, for `'pkgname'`, the directory would be `$XDG_CACHE_HOME/pkgname`. Default: `'astropy'`

    ensure_exists bool, keyword-only, optional

      Whether to create the directory (and its parents) if it’s missing. Default: True

      Added in version 8.0.

  Returns:
    Path

      The absolute path to the cache directory.