Skip to main content

#pyConfObject

Define configuration files from classes and its relations

It allows to load/export configuration from classes to json/yaml files easily It allows to have code completion on your configuration objects and not depend on dictionaries

Example

from numbers import Number
from confObj import ConfObj

class PgServerConf(ConfObj):
    ip: str = ""
    port: Number = 5432
    username:str = ""
    password:str = ""

class MainConf(ConfObj):
    pgconf: PgServerConf = PgServerConf()
    timezone:str = "UTC"


if __name__ == "__main__":
    conf = MainConf()
    print("Default configuration:")
    print(conf.as_json())
    conf.pgconf.username = "admin"
    print("Modified configuration for pg: ")
    print(conf.pgconf.as_json())

Usage

The idea behind this module is to create a configuration object that can be organized as a tree and IDE's code completion features can be used.

It should be used as:

  • Define the structure of the whole configuration defining classes that inherit from `confObj``
  • [optional] Assign default values to configuration items on code
  • Output the defined configuration tree as a file (either yaml or json)
    • [optional] Fix default values on the generated file
  • On runtime, either load configuration or use default hardcoded values.
    • [optional] On runtime, values can be changed and saved to file if necessary

Release files for pyConfObj 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyConfObj 0.1.5
File Size Uploaded
pyconfobj-0.1.5.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyConfObj 0.1.5
File Interpreter ABI Platform
pyconfobj-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / pyconfobj-0.1.5.tar.gz

Download URL pyconfobj-0.1.5.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
376eca8a49037565baac061c00df1a4441ba2cd83bbd24210d8c558ea8f99143
BLAKE2b-256 checksum
How to use checksums
78bb1211d9960d30aded2e15836cb738af2fc81f36514527212068496ce0f39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / pyconfobj-0.1.5-py3-none-any.whl

Download URL pyconfobj-0.1.5-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8256f0cb0f314c12c9177f59837f3b77fc8e5937eb1d8c803257f84c51dde5f
BLAKE2b-256 checksum
How to use checksums
84735c791cddc65a72eb9a90ff3fcdc7fce006105bed79479633ecc1e181533a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page