Skip to main content

A python package for managing YAML configuration

Project description

pyconfman2

pyconfman2 is designed to handle schema configurations by loading properties from a dictionary or a YAML configuration file. It provides methods for adding, getting, and removing properties from the schema.

Installation

python -m pip install pyconfman2

Usage

Basic

In it's most basic form, a Schema can be created which will load a local "config.yaml" or "config.yml" file present.

>>> from pyconfman2 import Schema
>>> config = Schema.ConfigSchema()
>>> print(config)
{}

Provide a default config

>>> from pyconfman2 import Schema
>>> config=Schema.ConfigSchema({"foo": "bar"})
>>> print(config)
{'foo': 'bar'}

Specify the default config file to load

>>> from pyconfman2 import Schema
>>> config=Schema.ConfigSchema(default_config="default_config.yaml")
>>> print(config)
{'foo': 'bar', 'zoo': {'jar': ['car', 'far']}}

Specify the config file to load

>>> from pyconfman2 import Schema
>>> config=Schema.ConfigSchema(default_config="default_config.yaml", filepath="another_config.yaml")
>>> print(config)
{'foo': 'overwritten_by_another_config', 'zoo': {'jar': ['car', 'far']}}

Schema Loading breakdown

  1. Load the hard-coded defaults
  2. Load (and override) using the "default config" file if present
  3. Load (and override) using the config file if present

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

pyconfman2-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

pyconfman2-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyconfman2-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for pyconfman2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d370b6714f37c829b3b7e9cbd5ae621d5dc45990e94d3e0cd4d4807cf48e236a
MD5 96c077f28ee294af2876ced1a3338ed1
BLAKE2b-256 1966fbb0c5666ac7746e65911f76412dbaa8fedee0eaa79d5b0f893b6e9b1197

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyconfman2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for pyconfman2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c3ddede880065bd8951f571021400c127cdf89867ce9087462a208fcde3e745
MD5 ac5abe709bd3e761abfc20ea68b694d4
BLAKE2b-256 acefa3e1481a3ee94eea01523c292461dc03d3dec0b19287894cb42c53b44624

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