Skip to main content

A lightweight, TOML-backed configuration/settings utility that that exposes project settings as standard Python dictionaries.

Project description

zettings

PyPI Python Versions PyPI - Downloads GitHub issues

Lines Of Code Codecov GitHub Actions Workflow Status

standard-readme compliant license

A lightweight, TOML-backed configuration/settings utility that that exposes project settings as standard Python dictionaries.

zettings is a Python configuration library designed for simplicity and developer ergonomics. It loads settings data from TOML files and exposes them as standard Python dictionaries — allowing you to work with settings in a familiar, Pythonic way.

Table of Contents

Features

  • TOML-powered: Uses TOML under the hood for modern, human-friendly settings files.
  • Dictionary-like interface: Access and manipulate settings with regular dictionary operations.
  • Nested access: Supports nested keys with dotted key notation.
  • Optional defaults: Provide default values for initializing the settings file or for when a key is missing in the settings file.
  • Optional always_reload: Reload the setting file everytime a key is read. (Enabled by default)
  • Optional filepath: Provide the exact file Path of the .toml file to use. (overrides name)

Install

# PyPI
pip install zettings

or

uv add zettings

Dependencies

Python 3.9 or greater

Usage

Example

This will create/use a 'settings.toml' file located in the '.zettings' directory of the user's home directory.

from zettings import Settings

# Standard Dictionary Format
defaults = {
    "settings": {
        "name": "MyName",
        "mood": "happy",
    },
}
# Dotted Key Notation
defaults = {}
defaults["settings.name"] = "MyName"
defaults["settings.mood"] = "happy"

settings = Settings(".zettings/settings.toml", defaults) # Change 'zettings' to your project's name

print(settings["settings.mood"])
settings["settings.mood"] = "angry"
print(settings["settings.mood"])

Contributing

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

Bug Reports and Feature Requests

Please use the issue tracker to report any bugs or request new features.

Contributors

License

MIT © Nick Stuer

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

zettings-1.0.0.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

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

zettings-1.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file zettings-1.0.0.tar.gz.

File metadata

  • Download URL: zettings-1.0.0.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for zettings-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d3cdb11f1bc54bb6f1410dc2b38e5c0c5c8dd1a964367a76e37df6cffce0cc83
MD5 d4c215d98f464402c8f5835c9cb6e550
BLAKE2b-256 c157547ccf4b332410fcd7c5053bb9256069719d2688082e6be25a44caef7ca6

See more details on using hashes here.

File details

Details for the file zettings-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: zettings-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for zettings-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d52ad36193157c3b187c16b18435d9cb224ae4e9b3857bef074a3a547cd79ac
MD5 8d0a1ddf4c5488db824d5298284b28b5
BLAKE2b-256 7eea213c4a92f574aba1b7a362a1acffd24b7f60c706554b354f4495412003dc

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