xdg
xdg is a Python module which provides functions to return paths to the
directories 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.
Installation
To install the latest release from PyPI, use pip:
python3 -m pip install xdg
In Python projects using Poetry or Pipenv for dependency management, add
xdg as a dependency with poetry add xdg or pipenv install xdg.
Alternatively, since xdg is only a single file you may prefer to just copy
src/xdg/__init__.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() return
pathlib.Path objects containing the value of the environment variable
named XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME respectively, or
the default defined in the specification if the environment variable is unset,
empty, or contains a relative path rather than absolute path.
xdg_config_dirs() and xdg_data_dirs() return a list of pathlib.Path
objects containing the value, split on colons, of the environment variable named
XDG_CONFIG_DIRS and XDG_DATA_DIRS respectively, or the default defined in
the specification if the environment variable is unset or empty. Relative paths
are ignored, as per the specification.
xdg_runtime_dir() returns a pathlib.Path object containing the value of the
XDG_RUNTIME_DIR environment variable, or None if the environment variable is
not set, or contains a relative path rather than absolute path.
Copyright
Copyright © 2016-2021 Scott Stevenson.
xdg is distributed under the terms of the ISC licence.
Metadata
Release files for xdg 5.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xdg-5.0.2.tar.gz | 4.5 kB | Without provenance | Details for xdg-5.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xdg-5.0.2-py3-none-any.whl | Python 3 | none | any | Details for xdg-5.0.2-py3-none-any.whl |
Total release size: 9.4 kB
Release files / xdg-5.0.2.tar.gz
| Download URL | xdg-5.0.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99a685c23dd6201b852f345f28f32099524d2677967cd413b74b39a62a866062
|
|
BLAKE2b-256 checksum How to use checksums |
61c62d0721a9c8b2789e0127521d8b259bf2e2400dd4a12a0add8a5cc239e9f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.6 Linux/5.8.0-50-generic
|
Release files / xdg-5.0.2-py3-none-any.whl
| Download URL | xdg-5.0.2-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d59c8a0c24293491a0a3325eb1beb7a9b03e0802385c2759ed9c19cd34602ddc
|
|
BLAKE2b-256 checksum How to use checksums |
34d206c652db79ec7d27df2eee9d30963488cb2f2554705256022b73d917c5c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.6 Linux/5.8.0-50-generic
|
Security for xdg 5.0.2
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.