Skip to main content

INI-config validator

Project description

buildci coveralls pyversions

DwnMonth DwnWeek DwnDay


This module helps to check configparser-loaded configurations.


  1. Initialize description of valid configuration: schema = configchecker.ConfigSchema()
  2. Add an information of possible sections by calling schema.section with section name validator and boolean flag „section required“.
  3. In every section describe possible section’s values by calling sect.value.

Name/value validators

There are basic validators:

  • ItemDefaultValidator — always returns true
  • ItemStringValidator — checks if a string equals to given (probably, case-insensitive)
  • ItemRegexValidator — checks matching a string to given regexp
  • ItemNumberValidator — checks that a string is a non-negative integer

And validator-composers which allow to create more complex checks:

  • ItemNotValidator, ItemAndValidator, ItemOrValidator — first-order logic on validators
  • ItemCountValidator — takes a validator and a function that check number of validator’s true positives (i.e. returns True)


import configparser
import configchecker as v

config = configparser.ConfigParser()

schema = v.ConfigSchema()

# Section with name „REQUIRED“ will be mandatory
with schema.section("REQUIRED") as s:
    # It must have keys matching regexp r'item_\d+' and numeric value and nothing more
    s.value(v.ItemRegexValidator(r'item_\d+', value_val=v.ItemNumberValidator()).no_other()

# Section with name r'OPT_\w+' (check by regexp) will be optional
with schema.section(v.ItemRegexValidator(r'OPT_\w+'), required=False) as s:
    # And it may have anything

# Other sections will be restricted

# Run checks

Also, you can find lots of examples in tests (


Samun Victor,

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for configchecker, version 0.95
Filename, size File type Python version Upload date Hashes
Filename, size configchecker-0.95.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View
Filename, size configchecker-0.95-py3-none-any.whl (6.9 kB) File type Wheel Python version 3.4 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page