Skip to main content

xdg is a tiny Python module which provides the variables defined by the XDG Base Directory Specification, to save you from duplicating the same snippet of logic in every Python utility you write that deals with user cache, configuration, or data files. It has no external dependencies and supports Python 2 and 3.

Installation

To install the latest release from PyPI, use pip:

pip install xdg

Alternatively, since xdg is only a single file you may prefer to just copy xdg.py from the source distribution into your project.

Usage

from xdg import (XDG_CACHE_HOME, XDG_CONFIG_DIRS, XDG_CONFIG_HOME,
                 XDG_DATA_DIRS, XDG_DATA_HOME, XDG_RUNTIME_DIR)

XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME are strings containing the value of the environment variable of the same name, or the default defined in the specification if the environment variable is unset or empty.

XDG_CONFIG_DIRS and XDG_DATA_DIRS are lists of strings containing the value of the environment variable of the same name split on colons, or the default defined in the specification if the environment variable is unset or empty.

XDG_RUNTIME_DIR is a string containing the value of the environment variable of the same name, or None if the environment variable is unset.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdg-1.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xdg-1.0.1-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file xdg-1.0.1.tar.gz.

File metadata

  • Download URL: xdg-1.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b9d64bcdfb7ee50d9e34236a05d5f48c5c31fe5ad69fd4f0937a0a103f1e45ef
MD5 beb7cdb25983ea7142aa1d2e7a9f9dd1
BLAKE2b-256 5ae7736cd150e8776e1025f8a2645b5ad1e412faf2eb82f09e8f35c65080b531

See more details on using hashes here.

File details

Details for the file xdg-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for xdg-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 02c2a1bcd43d451840c1a76a4e87bc8d4a57dd5023e73eb794732cb68d104d5b
MD5 b170b5abcdc3f1c5cd48308887856ef5
BLAKE2b-256 6b130c2f44c118eb5f53218fb70d793590392c6787c3d9015c546c3554f73b83

See more details on using hashes here.

Release history Release notifications | RSS feed

6.0.0

2 files

5.1.1

2 files

5.1.0

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.0.1

2 files

4.0.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.0.0

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

This release

1.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page