Perky Configuration Format

0.9.3 · active · verified Thu Apr 16

Perky is a new, simple, and Pythonic text file format designed for configuration files, serving as an alternative to INI, TOML, and JSON. It focuses on a minimal, human-friendly syntax and explicit data type handling, supporting strings, mappings (dicts), and sequences (lists) natively, leaving other type transformations to the user. The library is lightweight, fast, written in 100% pure Python, and currently maintained with version 0.9.3, supporting Python 3.6+.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to parse a Perky formatted string using `perky.loads`. The output will show how to access the parsed dictionary's values. Perky files support strings, dictionaries (mappings), and lists (sequences). Perky does not automatically convert values like 'True' to a boolean or '1.0' to a float; these remain as strings unless explicitly transformed by the user.

import perky

config_string = """
name = ExampleApp
version = 1.0
settings = {
  debug = True
  log_level = INFO
  features = [
    feature_a
    feature_b
  ]
}
"""

config = perky.loads(config_string)

print(config['name'])
print(config['settings']['debug'])
print(config['settings']['features'][0])

# Example of loading from a file (if 'config.perky' existed)
# with open('config.perky', 'w') as f:
#     f.write(config_string)
# file_config = perky.load('config.perky')
# print(file_config)

view raw JSON →