--- id: xdg version: "6.0.0" license: ISC license_treatment: permissive maintenance: active --- # xdg — Variables defined by the XDG Base Directory Specification License: permissive · Maintenance: active · Downloads: 674.7K/mo ## What it is and what it does xdg is a lightweight utility that implements version 0.8 of the XDG Base Directory Specification, a standard for where user applications should store configuration, cache, data, and runtime files on Unix-like systems. It exports functions that return pathlib.Path objects for each directory type, respecting environment variables like XDG_CONFIG_HOME and XDG_DATA_HOME when set to absolute paths, and falling back to specification defaults otherwise. The module has no external dependencies and is small enough to copy into a project if you prefer not to add a package dependency. The package handles the common pattern of checking environment variables, validating paths (rejecting relative paths), and providing sensible defaults—logic that would otherwise be duplicated across many utilities. It returns Path objects rather than strings, making it natural to use with modern Python filesystem code. The implementation is stable and straightforward, suitable for any application that needs to follow XDG conventions on Linux and other Unix systems. Use it for: - Store application configuration files in the user's XDG config directory instead of hardcoding paths. - Retrieve cache and temporary data directories for a CLI tool or daemon that respects system standards. - Build a utility that uses XDG paths on Unix and falls back gracefully on Windows. - Ensure a Python application respects user environment overrides for where data should be stored. - Implement multi-directory search paths for config files using xdg_config_dirs() to check system-wide and user directories. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides functions to retrieve XDG Base Directory Specification paths for user cache, configuration, data, and runtime directories, returning pathlib.Path objects with sensible defaults. Yes. The package is lightweight, has no dependencies, solves a real problem (avoiding duplicated XDG logic), and is actively maintained despite infrequent releases. The ISC license is permissive. Install it if your application needs to follow XDG standards on Unix systems; if you only target Windows or have trivial directory needs, it may be overkill. ## Install pip install xdg uv add xdg poetry add xdg ## Installing xdg Before you install: Low friction: pure Python, single-file module with zero runtime dependencies. Last release was 2023-02-27, but repo shows active maintenance with a commit on 2026-08-02, so the long gap between releases does not indicate abandonment. License in practice: ISC license is permissive and poses no restrictions on commercial or proprietary use. You can use, modify, and distribute this package freely with minimal obligations. Quickstart: pip install xdg-base-dirs from xdg import xdg_cache_home, xdg_config_home, xdg_data_home cache_dir = xdg_cache_home() config_dir = xdg_config_home() data_dir = xdg_data_home() Requires Python >=3.7,<4.0 according to metadata; description notes 3.10 as minimum for current versions. Verify before relying: - Whether Python 3.7-3.9 support listed in classifiers is actively maintained or outdated. - Current test coverage and whether all XDG specification edge cases (relative paths, empty vars) are well-handled. - Whether the single-file design means copying src/xdg_base_dirs/__init__.py into a project is a practical alternative to package installation. ## Package facts - License: ISC (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 674.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags xdg base directory paths, user config cache data directories, xdg specification implementation, cross-platform user directories, xdg environment variables, system directory standards, xdg-specification, unix-paths, configuration-management [View on SkillFed](https://skillfed.io/packages/xdg) · [View on PyPI](https://pypi.org/project/xdg/)