Consistent TOML for Python


Keywords
toml
License
Other
Install
pip install contoml==0.32

Documentation

Consistent TOML for Python

Build Status Python Versions Release Wheel Join the chat at https://gitter.im/Jumpscale/python-consistent-toml

A Python module for updating data within TOML files without messing up their nice formating. This is achieved by preserving the parsed/constructed TOML data structures as lexical tokens internally and having the data manipulations performed directly on the tokens.

Installation

pip install --upgrade contoml

Usage

>>> import contoml

>>> toml_file = contoml.load('sample.toml')

# The anonymous table is accessible using the empty string key on the TOML file
>>> toml_file['']['title']
'TOML Example'

# You can modify table values in-place
>>> toml_file['fruit'][1]['variety'][0]['points'][0]['y'] = 42
>>> toml_file['servers']['alpha']['ip'] = '192.168.0.111'
>>> toml_file['environment'] = {'OS': 'Arch Linux', 'Type': 'GNU/Linux'}