Skip to main content

A Python package for processing and validating configuration dictionaries against a custom .kv file format

Project description

kvProcessor

PYPI Package
A Python package for processing and validating configuration dictionaries against a custom .kv file format.

Installation

Install via pip:

pip install kvprocessor

File format

VARIBLENAME<TYPE>:DEFAULTVAULE

Usage

from kvprocessor import LoadEnv, KVProcessor

kv_file_path = "test/test.kv" # Directory to .kv file
kv_processor = KVProcessor(kv_file_path) # Create a KV processor class
kv_keys = kv_processor.return_names() # Gets the keys (VARIBLENAME) from the .kv file
env_list = LoadEnv(kv_keys) # Loads all the ENV varibles that match those keys
validated_config = kv_processor.process_config(env_list) # Verifies that those env varibles exist and are of the correct type
print(validated_config)

This example mimics the one found in the /test directory. With the kv file of:

DATABASE_NAME<string>:none
DATABASE_USER<string>:none
DATABASE_PASSWORD<string>:none
DATABASE_HOST<string>:none
DATABASE_PORT<string|int>:none
DATABASE_DRIVER<string>:mysql+mysqlconnector
DATABASE_DIALECT<string>:none

You should get a result of: {'DATABASE_NAME': None, 'DATABASE_USER': None, 'DATABASE_PASSWORD': None, 'DATABASE_HOST': None, 'DATABASE_PORT': None, 'DATABASE_DRIVER': None, 'DATABASE_DIALECT': None} This is because the kvProcessor is taking input from the env, and we dont have these env varibles defined. As a result these values default to the defined default value

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

kvprocessor-0.1.6.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

kvprocessor-0.1.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file kvprocessor-0.1.6.tar.gz.

File metadata

  • Download URL: kvprocessor-0.1.6.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for kvprocessor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 63bab8bd8ab4c9d702716eba3539d5a4d238c13834ae3f46c0252a3b90b3a966
MD5 a2228462cd41d156268632dcc8df3c38
BLAKE2b-256 d7a82b662e6f30505640e5945ce4069dd80c7ff5dc736dfe11b6f2fdadfa2294

See more details on using hashes here.

File details

Details for the file kvprocessor-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: kvprocessor-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for kvprocessor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5c9b622bc5a4e66868b64ea0560163ef539b48685e962f7445adf1deee97b104
MD5 e0b236d5c135a89b6c12b0972e14aeb2
BLAKE2b-256 0f2ffe45af6b806cbeda40331d1130759c7bff3189ae00b22de70dcdd02bc5e3

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