Skip to main content

Small package for working with config files

Project description

ManageConfig

PyPI Python License

Tiny, practical config loader that turns JSON and YAML into dot-access objects. Designed for scripts, CLIs, and small services that want clean config access without a heavy dependency tree.

Highlights

  • Dot access for nested config values (conf.db.host)
  • JSON and YAML support with a single API
  • Lightweight, no magic beyond clean attribute access
  • Friendly to scripts and small apps

Install

pip install manageconfig

Quickstart

from manageconfig import Config

conf = Config.load_from_yml("config.yml")

print(conf.string2)
print(conf.string1)

# Prints "localhost"
print(conf.mysqldatabase.hostname)

# i == 3013
i = conf.mysqldatabase.port + 1

Use Cases

  • Project settings loaded once and reused across modules
  • Local dev secrets and per-environment configuration
  • Lightweight config handling in CLI tools

Example Config (YAML)

# comment syntax

# basic syntax - key and value separated by colon and space before the value
key: value

# Scalar data types
integerValue: 1                     # integer value
floatingValue: 1                     # floating value

stringValue: "456"                  # string with double quotes
stringValue: 'abc'                   # string with single quotes
stringValue: wer                     # string without quotes

booleanValue: true                   # boolean values - true or false

# Multiline string with literal block syntax - preserved new lines
string1: |
  Line1
  line2
  "line3"
  line4

# Multiline strings with folded block syntax - new lines are not preserved,
# leading and trailing spaces are ignored
string2: >
  Line1
  line2
  "line3"
  line4

# Collection sequence data types
arraylist:
  - One
  - two
  - Three

arraylist2: [one, two , three]

mysqldatabase:
  hostname: localhost
  port: 3012
  username: root
  password: root

JSON Support

Use Config.load_from_json("config.json").

API

  • Config.load_from_yml(path) loads YAML into a dot-access object
  • Config.load_from_json(path) loads JSON into a dot-access object

Testing

tox

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

manageconfig-1.1.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

manageconfig-1.1.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file manageconfig-1.1.2.tar.gz.

File metadata

  • Download URL: manageconfig-1.1.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for manageconfig-1.1.2.tar.gz
Algorithm Hash digest
SHA256 44932cf260c2d359342e81792ed6e0b6b5db402aba030767bf4fe5e2078703dd
MD5 e7600b7b3f3ba8e8534205708204d3e1
BLAKE2b-256 82486f1b7a6be2fb05a72e399ba4a4cc17fd992582294c4270fe27307f5ba560

See more details on using hashes here.

File details

Details for the file manageconfig-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: manageconfig-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for manageconfig-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c48edbd7a3cd6a09d05a2f06999c088660723dc73f9b9e93cf12a83ffac9403
MD5 84a567d2eb82dcd8bcc258f8c5f714d9
BLAKE2b-256 bf9c4170dd804f2942396aab6cb4015b1cbcd67e9eac2caac59460c2d4267f4f

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