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.7.tar.gz (6.0 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.7-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kvprocessor-0.1.7.tar.gz
  • Upload date:
  • Size: 6.0 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.7.tar.gz
Algorithm Hash digest
SHA256 5e4c8f19d160054486c71741ffab26e3df1a7a8b9d4cadb77806c4661df657c0
MD5 50945d0f3d7cd02ead7125a5f3624d11
BLAKE2b-256 48f154a7803877315242412416155a403c5f23fcbe4374069f3bab755b84f73b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kvprocessor-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f4d7622646f9cbbee6e70557eefab097663e38800024e75588a92ce9484aa3ec
MD5 dc3ccc53c6b8571d510f4d4151a90658
BLAKE2b-256 4f01c51aa63ee97a9704ba1da55a6170a5ddab48e669a8f6fa6bed7cb64668ac

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