Getting started

AppData is a Python library to access app data paths based on the operating system the app is running on.

Install AppData

To install AppData package from PyPI run the following command in your terminal (Python and Pip should be installed)

pip install appdata

After that you could use the functionality of this library.

Using AppData

The main class that is used by the package is AppDataPaths:

from appdata import AppDataPaths

The default initialization:

app_paths = AppDataPaths()
app_paths.setup()

By default the current working directory name is used as name for app data folder. The folder destination depends on the operating system your app is ranning on. setup() function allows to create folders that are not created. To delete all the files generated by the library use:

app_paths.clear(everything=True)

To check if setup() is required use:

app_paths.require_setup

The AppDataPaths class allows to access different paths for the application.

Application data path

To access application data root path:

app_paths.app_data_path

Config path

To access application config file path use:

app_paths.config_path

Or if you would like to get specific config file path:

app_paths.get_config_path(
    name='some_name',
    ext='.conf'
)

Logs path

To access logs folder path use:

app_paths.logs_path

To access default log file use:

app_paths.log_file_path

Or if you would like to get specific log file:

app_paths.get_log_file_path(name='some_log')