types-appdirs (Type Stubs for appdirs)

1.4.3.5 · deprecated · verified Thu Apr 16

types-appdirs is a PEP 561 type stub package providing static type checking information for the 'appdirs' library. It enables type-checking tools like Mypy and Pyright to analyze code using 'appdirs'. The package is currently at version 1.4.3.5 (released March 14, 2023). This package is unmaintained and deprecated; users are encouraged to migrate to 'platformdirs', which includes its own type information.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `appdirs` (for which `types-appdirs` provides stubs) to retrieve common application-specific directory paths for the current user and platform. It also shows how to create one of these directories, as `appdirs` only provides the path strings.

from appdirs import user_data_dir, user_config_dir, user_cache_dir
import os

appname = "MyAwesomeApp"
appauthor = "MyCompany"

# Get user-specific data directory
data_dir = user_data_dir(appname, appauthor)
print(f"User Data Directory: {data_dir}")

# Get user-specific configuration directory
config_dir = user_config_dir(appname, appauthor)
print(f"User Config Directory: {config_dir}")

# Get user-specific cache directory
cache_dir = user_cache_dir(appname, appauthor, version="1.0")
print(f"User Cache Directory (v1.0): {cache_dir}")

# Create a directory if it doesn't exist (appdirs does not create paths automatically)
os.makedirs(data_dir, exist_ok=True)
print(f"Ensured data directory exists: {data_dir}")

view raw JSON →