appdirs-stubs

0.2.0 · maintenance · verified Thu Apr 16

Type stubs for the `appdirs` library, providing static type checking support for code using `appdirs`. This helps tools like MyPy, PyRight, and PyCharm analyze `appdirs` usage. While `appdirs-stubs` is currently maintained (latest version 0.2.0, released Jan 10, 2026), the underlying `appdirs` library has been officially deprecated since 2020 in favor of `platformdirs`.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing and using `appdirs` functions with type hints, including an `if TYPE_CHECKING` block to illustrate type-checking functionality with the stubs.

from appdirs import user_data_dir
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    # This block is only for type checkers and helps verify stub correctness
    appname: str = "MyApplication"
    appauthor: str = "MyCompany"
    data_path: str = user_data_dir(appname, appauthor)
    # Example: Check if the return type is str
    reveal_type(data_path)

# Runtime usage of appdirs (requires 'appdirs' package installed)
app_name_runtime = "MyAwesomeApp"
app_author_runtime = "CoolDevs"
runtime_data_path = user_data_dir(app_name_runtime, app_author_runtime)
print(f"User data directory: {runtime_data_path}")

view raw JSON →