Skip to main content

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

Project description

kvProcessor

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: kvprocessor-0.1.2.tar.gz
  • Upload date:
  • Size: 4.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.2.tar.gz
Algorithm Hash digest
SHA256 0ee6d6bc2354249ffb1f495bdc49e226e74c240e90c2ba97e07e7f4814452259
MD5 d295b78f5ca9964b0735a40c6fa6244b
BLAKE2b-256 b83b6c89bb11fe49c2757d9eafcc6f2ea4d95eabfcc03457258c40225051274c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kvprocessor-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c23306f416f58a39f7690d2cadaccbad2b731d1e46628310400ce5ea3b1318f
MD5 bb64c6efe1a482f02ffd3f46035ffb5c
BLAKE2b-256 a7a3f9257a64c8d5c8217db4a89eac1d7e2b992fce9ec7e3ea7a31b472ad52a3

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