xdg
Variables defined by the XDG Base Directory Specification
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.7,<4.0 according to metadata; description notes 3.10 as minimum for current versions.
- 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 · maintenance · safety
ISC (permissive) — 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.
last release 2023-02-27 (1264 days) · last repo commit 2026-08-02 · 160 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 674,715 downloads/mo, #5,389 on PyPI
Alternatives
Verify before relying
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()- 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.
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 on this page. Verify before relying on it.
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
xdg on PyPI
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.
Requires Python >=3.7,<4.0 according to metadata; description notes 3.10 as minimum for current versions.
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()
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 the current Python release >=3.7,<4.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1,264 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 674,715 / month, #5,389 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 7 - InactiveIntended Audience :: DevelopersLicense :: OSI ApprovedNatural Language :: EnglishOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: xdg-6.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “xdg specification implementation”
- xdgProvides functions to retrieve XDG Base Directory Specification paths…
- xdg-base-dirsProvides functions to retrieve XDG Base Directory Specification paths…
- appdirsDetermines the correct platform-specific directory for storing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also xdg-base-dirs · appdirs · platformdirs · pyprojroot · pytest-env · path.py · pystow · emport · findlibs · pathlib-abc