Skip to main content

Load YAML configuration respecting XDG

Project description

configize

Python library to find and fetch YAML configuration for a program, respecting the XDG base directory specification.

Example

from configize import configize


# This will use $XDG_CONFIG_HOME
# The following files will be searched for, and the first existing file will be used:
# (Note, NAME is populated from the class kwarg 'Name')
# - $XDG_CONFIG_HOME/NAME.yaml
# - $XDG_CONFIG_HOME/NAME.yml
# - $XDG_CONFIG_HOME/NAME/NAME.yaml
# - $XDG_CONFIG_HOME/NAME/NAME.yml
# - $XDG_CONFIG_HOME/NAME/config.yaml
# - $XDG_CONFIG_HOME/NAME/config.yml
c = configize(Name="myproject")

# Alternatively, if using a custom path instead of XDG:
c = configize(Name="myproject", Path="/etc/myproject")

# the path field contains a pathlib.Path object to the config file
print(c.path)

# the config field contains a deserialized dict from the YAML file contents
print(c.config)

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

Configize-1.0.1.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

Configize-1.0.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Configize-1.0.1.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for Configize-1.0.1.tar.gz
Algorithm Hash digest
SHA256 80e0961540153c6ac76b3e56f18e6955882ac5b7296f69e0c76bc2e0289b8317
MD5 95b833da4838a709c38cb0de696cb517
BLAKE2b-256 bf78b562991ee5f948c3a5c3cebbef6d263a6866112332508bd982b1c6d4e948

See more details on using hashes here.

File details

Details for the file Configize-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: Configize-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for Configize-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 761f34181b27f16aeeb7a55b561d49be6ebedf90b5f49ded175cef36f1f1f531
MD5 c70c2be723c410404d074fc2e62dc1a0
BLAKE2b-256 b19c9c727b08170c350d054495245620a8e3a9e040563793720ba69e1375cc32

See more details on using hashes here.

Supported by

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