Skip to main content

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
print(XDGDirectory("XDG_CONFIG_HOME").path)
print(XDGDirectory("XDG_CACHE_HOME").path)
print(XDGDirectory("XDG_DATA_HOME").path)
# ...

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
print(XDGDirectories("XDG_CONFIG_DIRS").paths)
# generator of actually existing, unique directories
print(list(XDGDirectories("XDG_CONFIG_DIRS").existing_paths))

Installation

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

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

Metadata

Release files for xdgspec 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xdgspec 0.2.1
File Size Uploaded Provenance
xdgspec-0.2.1.tar.gz 4.0 kB Without provenance Details

Release files / xdgspec-0.2.1.tar.gz

Download URL xdgspec-0.2.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
384d8dba4e033aef83fc72981edb8431db0af89de64f6cc25afe6276e2746413
BLAKE2b-256 checksum
How to use checksums
d596625c6507eca9e24c3e4f9c807d8f3e064efb341b53364dd54ccb1a3ad2dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

Security for xdgspec 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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