Skip to main content

xdgpspconf - XDG Platform Suited Project configuration

Project description

XDG Platform Suited Project CONFiguration

Gist

Source Code Repository

source Repository

pages Documentation

Badges

Pipeline Coverage PyPI - version PyPI - format PyPi - pyversion

Description

Handle platform suited xdg-base to

  • Read configuration from standard locations.

    • supported formats:
      • yaml

      • json

      • toml

      • conf (ini)

  • Write configuration to most general, writable xdg-location

  • Locate standard directories:
    • xdg_cache

    • xdg_config

    • xdg_data

    • xdg_state

XDG Specification

View xdg specifications here.

What does it do

  • Lists possible xdg-locations (existing and prospective)

CACHE

XDG_CACHE_HOME

DATA

  • XDG_DATA_HOME

  • XDG_DATA_DIRS

STATE

  • XDG_STATE_HOME

  • XDG_STATE_DIRS

CONFIG

  • Reads configuration files from standard Windows/POSIX locations, current folder and optionally all ancestors and custom locations.

Platform-specific
Windows
  • %LOCALAPPDATA%\<PROJECT>\config

  • %USERPROFILE%\AppData\Local\<PROJECT>\config

POSIX

[Linux/MacOS]

  • ${XDG_CONFIG_HOME:-${HOME}/.config}/<PROJECT>/config

  • ${XDG_CONFIG_HOME:-${HOME}/.config}/<PROJECT>

  • ${XDG_CONFIG_HOME:-${HOME}/.config}/<PROJECT>rc

  • $DIR/<PROJECT>/config for each $DIR in $XDG_CONFIG_DIRS

Environment

  • declared variable: %<PROJECT>RC% for Windows or $<PROJECT> for POSIX

Improper

  • ${HOME}/.<PROJECT>rc

Custom

  • configuration path: supplied in function

Relative

./.<PROJECT>rc

Ancestors

Any of the parents, till project root or mountpoint, that contains __init__.py, where,

  • project root is the directory that contains setup.cfg or setup.py

  • mountpoint is checked using pathlib.Path.drive on windows or pathlib.Path.is_mount() on POSIX

TODO

  • Implementation for following variables:
    • XDG_RUNTIME_DIR

    • Other XDG specifications.

    • Arbitrarily defined XDG_.* environment variables

Project details


Download files

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

Source Distribution

xdgpspconf-1.1.1.tar.gz (27.3 kB view hashes)

Uploaded Source

Built Distribution

xdgpspconf-1.1.1-py3-none-any.whl (25.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page