Skip to main content

Convenient access to XDG Base Directory Specification variables

Project description

xdgspec Python package

pipeline status coverage report documentation PyPI

xdgspec is a simple Python package to provide convenient access to the variables defined in the XDG Base Directory Specification.

What can xdgspec do?

With xdgspec you can:

Access the XDG Base Directory variables with Appropriate Fallbacks

from xdgspec import XDGDirectory
# ...

Use a Context Manager to Automatically Create One of the XDG Base Directories if it doesn't exist

from xdgspec import XDGDirectory
with XDGDirectory("XDG_CONFIG_HOME") as path:
    print("{} is now definitely existing".format(path))

Access and Create Package Directories

from xdgspec import XDGPackageDirectory
with XDGPackageDirectory("XDG_CONFIG_HOME","mypackage") as path:
    # path = ~/.config/mypackage
    print("{} is now definitely existing".format(path))

Loop Over Existing XDG System Directories

from xdgspec import XDGDirectories
# variable content
# generator of actually existing, unique directories


The xdgspec package is best installed via pip. Run from anywhere:

python3 -m pip install --user xdgspec

This downloads and installs the package from the Python Package Index.

You may also install xdgspec from the repository root:

python3 -m pip install --user .


Documentation of the xdgspec package can be found here on GitLab.

Project details

Download files

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

Files for xdgspec, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size xdgspec-0.2.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page