get_config_dir#

astropy.config.get_config_dir(rootname='astropy', *, ensure_exists=True)[source]#

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

This directory is typically $XDG_CONFIG_HOME/<namespace>, but can be overwritten with the ASTROPY_CONFIG_DIR environment variable, or with temporary_config_dir_path.

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

Parameters:
rootnamepython:str, optional

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

ensure_existsbool, keyword-only, optional

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

Added in version 8.0.0.

Returns:
python:str

The absolute path to the cache directory.

See also

get_config_dir_path

same as this function, except that the return value is a pathlib.Path